saganhim / gpuocelot

Automatically exported from code.google.com/p/gpuocelot
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Take the following code:

#include <GL/glut.h>
#include <cstdio>

void display(void){

}

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");
    glutDisplayFunc(display);
    printf("g\n");
    glutMainLoop();
    return 0;
}

2. Compile and run it once without and once with linking to ocelot:
gcc   -c main.cpp && gcc -o main main.o  -lglut -lstdc++ && ./main
gcc   -c main.cpp && gcc -o main main.o  -locelot -lglut -lstdc++ && ./main

3. Look at the console output.

What is the expected output? What do you see instead?
When I run the program not linked to ocelot, it outputs the following:
./main
a
b
c
d
e
f
g

When I run the program linked to ocelot, it breaks:
./main
a
b
c
d
e
main: 
/build/src/llvm-ce7bbb8b46abd1aef80dff50bd73315719e1f8bb/include/llvm/Support/Co
mmandLine.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)

What version of the product are you using? On what operating system?
The program was compiled under Arch Linux with all current upgrades, LLVM 
3.3-1, gpuocelot r2235, freeglut 2.8.1 and mesa 9.1.3. 

Please provide any additional information below.
When compiling with nvcc or when testing the CUDA code samples (e.g. simpleGL), 
the same error appears.
The same error appears as well under Ubuntu 11.04 with completely different 
library versions (gpuocelot was r2235 as well).

Original issue reported on code.google.com by max.m...@dameweb.de on 19 Jun 2013 at 1:59