[LLVMdev] lli problem with a simple OpenGL

sara.elshobaky sara.elshobaky at laposte.net
Sat Jan 26 09:55:37 PST 2013


I wrote a very simple openGL application, as below

int main(int argc, char **argv)
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutCreateWindow("red 3D lighted cube");
  printf("GL_VERSION = %s\n",glGetString(GL_VERSION) );
  return 0;

Compiling it with Clang and adding -lglut option worked correctly
$ clang  simple.c  -o  simple  -lglut
$ ./simple
GL_VERSION = 2.1 Mesa 7.10.2

But, adding the -emit-llvm option to clang, does not work as below
$ clang -O3 -emit-llvm simple.c  -o simple.bc -lglut
/usr/bin/ld: /usr/local/bin/../lib/LLVMgold.so: error loading plugin
/usr/bin/ld: /usr/local/bin/../lib/LLVMgold.so: error in plugin cleanup (ignored)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Also, removing the -lglut option worked with clang but failed with lli as below
$ clang -O3 -emit-llvm simple.c -c -o simple.bc
$ lli simple.bc
LLVM ERROR: Program used external function 'glutInit' which could not be resolved!

Please advice how to run it using the llvm jit 'lli'

Thanks in advance

Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130126/71730723/attachment.html>

More information about the llvm-dev mailing list