LLVM error when using glut: Assertion "Option already exists!" failed.

97 views
Skip to first unread message

jellysheep

unread,
Jun 19, 2013, 9:29:14 AM6/19/13
to gpuo...@googlegroups.com
Hi, 
consider the following small program:
#include <GL/glut.h>
#include <cstdio>

int main(int argc, char** argv){
printf("a\n");
glutInit(&argc, argv);
printf("b\n");
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
printf("c\n");
glutInitWindowSize(100, 100);
printf("d\n");
glutInitWindowPosition(100, 100);
printf("e\n");
glutCreateWindow("test");
printf("f\n");
glutMainLoop();
return 0;
}
 
Linked without gpuocelot it works:
gcc   -c main.cpp
gcc -o main main.o  -lglut -lstdc++ -L/opt/cuda/lib64
./main
a
b
c
d
e
f
 
When I link it to ocelot, it breaks:
gcc   -c main.cpp
gcc -o main main.o  -locelot -lglut -lstdc++ -L/opt/cuda/lib64
./main
a
b
c
d
e
main: /build/src/llvm-ce7bbb8b46abd1aef80dff50bd73315719e1f8bb/include/llvm/Support/CommandLine.h:646: void llvm::cl::parser<DataType>::addLiteralOption(const char*, const DT&, const char*) [with DT = llvm::FunctionPass* (*)(); DataType = llvm::FunctionPass* (*)()]: Assertion `findOption(Name) == Values.size() && "Option already exists!"' failed.
make: *** [run] Aborted (core dumped)

You can see that it is the "glutCreateWindow" function that causes LLVM to break the application. This also happens when using the nvcc compiler or when trying the CUDA examples (e.g. simpleGL).
After searching a while for this error I found out that this error appears when an .o file is linked twice with an application (compare the threads here and here). But that isn't the case here.

What is the reason for this error and how can it be solved?

Thank you very much,
jellysheep
Reply all
Reply to author
Forward
0 new messages