CUDA BY EXAMPLE examples don't work
Hi,

I'm trying to compile the CUDA BY EXAMPLE examples but cannot make it run :S here's the output of the compiler


[code]BRabbit$ nvcc julia_gpu.cu In file included from ../common/cpu_bitmap.h:20,
from julia_gpu.cu:18:
../common/gl_helper.h:44:21: error: GL/glut.h: No such file or directory
../common/gl_helper.h:45:22: error: GL/glext.h: No such file or directory
../common/gl_helper.h:46:20: error: GL/glx.h: No such file or directory[/code]

Any ideas?
Hi,



I'm trying to compile the CUDA BY EXAMPLE examples but cannot make it run :S here's the output of the compiler





BRabbit$ nvcc julia_gpu.cu In file included from ../common/cpu_bitmap.h:20,

from julia_gpu.cu:18:

../common/gl_helper.h:44:21: error: GL/glut.h: No such file or directory

../common/gl_helper.h:45:22: error: GL/glext.h: No such file or directory

../common/gl_helper.h:46:20: error: GL/glx.h: No such file or directory




Any ideas?

#1
Posted 02/02/2011 10:34 AM   
OS X has the OpenGL headers in a different place to the standard layout that code is written to expect. Rather than just GL/, headers are located in OpenGL/ and GLUT/. You will need to modify the preprocessor #include statements accordingly.
OS X has the OpenGL headers in a different place to the standard layout that code is written to expect. Rather than just GL/, headers are located in OpenGL/ and GLUT/. You will need to modify the preprocessor #include statements accordingly.

#2
Posted 02/02/2011 01:56 PM   
Hi thanks,

I change the #include statements but still the last one can't be found

[code]#include <GLUT/glut.h>
#include <OpenGL/glext.h>
#include <GL/glx.h> //Didn't work
#include <GLUT/glx.h> //the same
#include <OpenGL/glx.h> // the same[/code]

is it that the last library doesn't exist in Mac OS X?
the errors are the following:

[code]
Undefined symbols:
"_glDrawPixels", referenced from:
CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glClear", referenced from:
CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutInit", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glFlush", referenced from:
CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutMainLoop", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutInitDisplayMode", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutInitWindowSize", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutCreateWindow", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutDisplayFunc", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glClearColor", referenced from:
CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o
"_glutKeyboardFunc", referenced from:
CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

[/code]
Hi thanks,



I change the #include statements but still the last one can't be found



#include <GLUT/glut.h>

#include <OpenGL/glext.h>

#include <GL/glx.h> //Didn't work

#include <GLUT/glx.h> //the same

#include <OpenGL/glx.h> // the same




is it that the last library doesn't exist in Mac OS X?

the errors are the following:





Undefined symbols:

"_glDrawPixels", referenced from:

CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glClear", referenced from:

CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutInit", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glFlush", referenced from:

CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutMainLoop", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutInitDisplayMode", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutInitWindowSize", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutCreateWindow", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutDisplayFunc", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glClearColor", referenced from:

CPUBitmap::Draw() in tmpxft_0000065a_00000000-12_julia_gpu.o

"_glutKeyboardFunc", referenced from:

CPUBitmap::display_and_exit(void (*)(void*))in tmpxft_0000065a_00000000-12_julia_gpu.o

ld: symbol(s) not found

collect2: ld returned 1 exit status


#3
Posted 02/02/2011 02:22 PM   
You need to link GLUT and OpenGL

nvcc julia_gpu.cu -Xlinker -framework,GLUT -Xlinker -framework,OpenGL
You need to link GLUT and OpenGL



nvcc julia_gpu.cu -Xlinker -framework,GLUT -Xlinker -framework,OpenGL

#4
Posted 02/02/2011 08:19 PM   
Thanks a lot. I'm trying to learn also OpenGL.
Why do we have to link GLUT and OpenGL at compile time in Mac OS X? is it the same in all other OS?
Thanks a lot. I'm trying to learn also OpenGL.

Why do we have to link GLUT and OpenGL at compile time in Mac OS X? is it the same in all other OS?

#5
Posted 02/02/2011 08:49 PM   
Yes.
Yes.

#6
Posted 02/02/2011 09:26 PM   
[quote name='mfatica' date='02 February 2011 - 09:19 PM' timestamp='1296677960' post='1187934']
You need to link GLUT and OpenGL

nvcc julia_gpu.cu -Xlinker -framework,GLUT -Xlinker -framework,OpenGL
[/quote]

Hi,

I tried the same:

#include <GLUT/glut.h>
#include <OpenGL/glext.h>
#include <GLUT/glx.h> //the same
#include <OpenGL/glx.h> // the same

but I still have a little problem:

%nvcc julia_gpu.cu -Xlinker -framework,GLUT -Xlinker -framework,OpenGL
In file included from ../common/cpu_bitmap.h:20,
from julia_gpu.cu:18:
../common/gl_helper.h:47:38: error: GLUT/glx.h: No such file or directory
../common/gl_helper.h:48:37: error: OpenGL/glx.h: No such file or directory

Thank you very much in advance for your help.
[quote name='mfatica' date='02 February 2011 - 09:19 PM' timestamp='1296677960' post='1187934']

You need to link GLUT and OpenGL



nvcc julia_gpu.cu -Xlinker -framework,GLUT -Xlinker -framework,OpenGL





Hi,



I tried the same:



#include <GLUT/glut.h>

#include <OpenGL/glext.h>

#include <GLUT/glx.h> //the same

#include <OpenGL/glx.h> // the same



but I still have a little problem:



%nvcc julia_gpu.cu -Xlinker -framework,GLUT -Xlinker -framework,OpenGL

In file included from ../common/cpu_bitmap.h:20,

from julia_gpu.cu:18:

../common/gl_helper.h:47:38: error: GLUT/glx.h: No such file or directory

../common/gl_helper.h:48:37: error: OpenGL/glx.h: No such file or directory



Thank you very much in advance for your help.

#7
Posted 02/03/2011 07:23 PM   
Change the following lines in your gl_helper.

from:
#else

/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */
#include <GL/glut.h>
#include <GL/glext.h>
#include <GL/glx.h>
#endif


To:

#else

/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */
#if defined(__APPLE__) || defined(MACOSX)
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#include <GL/glext.h>
#include <GL/glx.h>
#endif

It should work ( it works for me)
Change the following lines in your gl_helper.



from:

#else



/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */

#include <GL/glut.h>

#include <GL/glext.h>

#include <GL/glx.h>

#endif





To:



#else



/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */

#if defined(__APPLE__) || defined(MACOSX)

#include <GLUT/glut.h>

#else

#include <GL/glut.h>

#include <GL/glext.h>

#include <GL/glx.h>

#endif



It should work ( it works for me)

#8
Posted 02/03/2011 07:38 PM   
[quote name='mfatica' date='03 February 2011 - 08:38 PM' timestamp='1296761923' post='1188408']
Change the following lines in your gl_helper.

from:
#else

/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */
#include <GL/glut.h>
#include <GL/glext.h>
#include <GL/glx.h>
#endif


To:

#else

/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */
#if defined(__APPLE__) || defined(MACOSX)
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#include <GL/glext.h>
#include <GL/glx.h>
#endif

It should work ( it works for me)
[/quote]

That's great, Thank you so much! It works for me too! Perfect!
[quote name='mfatica' date='03 February 2011 - 08:38 PM' timestamp='1296761923' post='1188408']

Change the following lines in your gl_helper.



from:

#else



/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */

#include <GL/glut.h>

#include <GL/glext.h>

#include <GL/glx.h>

#endif





To:



#else



/* On Linux, include the system's copy of glut.h, glext.h, and glx.h */

#if defined(__APPLE__) || defined(MACOSX)

#include <GLUT/glut.h>

#else

#include <GL/glut.h>

#include <GL/glext.h>

#include <GL/glx.h>

#endif



It should work ( it works for me)





That's great, Thank you so much! It works for me too! Perfect!

#9
Posted 02/03/2011 10:04 PM   
Actually in Mac OS X there's no "glx.h" so just don't use it mines work fine I use the following libraries:

[code]#include <GLUT/glut.h>
#include <OpenGL/glext.h>
#include <OpenGL/glu.h>
#include <OpenGL/gl.h>[/code]
Actually in Mac OS X there's no "glx.h" so just don't use it mines work fine I use the following libraries:



#include <GLUT/glut.h>

#include <OpenGL/glext.h>

#include <OpenGL/glu.h>

#include <OpenGL/gl.h>

#10
Posted 02/04/2011 12:41 AM   
Hello, sorry for bringing this back from so long ago but I have a mac too and I'm trying to make the changes so I can run the code as well and I'm not doing something right.

So I essentially followed mfatica's directions and changed the specified lines in my glhelper but still it doesn't compile. Do I also need to do something else?

I still get the error

"In file included from ../common/cpu_bitmap.h:20,
from julia_gpu.cu:18:
../common/gl_helper.h:51:21: error: GL/glut.h: No such file or directory
../common/gl_helper.h:52:22: error: GL/glext.h: No such file or directory
../common/gl_helper.h:53:21: error: GL/glx.h: No such file or directory"

Any help? Thanks
Hello, sorry for bringing this back from so long ago but I have a mac too and I'm trying to make the changes so I can run the code as well and I'm not doing something right.



So I essentially followed mfatica's directions and changed the specified lines in my glhelper but still it doesn't compile. Do I also need to do something else?



I still get the error



"In file included from ../common/cpu_bitmap.h:20,

from julia_gpu.cu:18:

../common/gl_helper.h:51:21: error: GL/glut.h: No such file or directory

../common/gl_helper.h:52:22: error: GL/glext.h: No such file or directory

../common/gl_helper.h:53:21: error: GL/glx.h: No such file or directory"



Any help? Thanks

#11
Posted 02/02/2012 05:27 AM   
Try this tar file, everything should work aside from GL Interoperability.
Untar the file and type make in the main directory.

Edit: the system rejected .tgz files, now posted as .tar
Try this tar file, everything should work aside from GL Interoperability.

Untar the file and type make in the main directory.



Edit: the system rejected .tgz files, now posted as .tar

#12
Posted 02/02/2012 08:02 PM   
Thanks mfatica for responding, but which tar file? I don't see one attached.


edit: just made my email public if it's easier to email it to me. Thanks again.
Thanks mfatica for responding, but which tar file? I don't see one attached.





edit: just made my email public if it's easier to email it to me. Thanks again.

#13
Posted 02/02/2012 08:55 PM   
Scroll To Top