I’m trying to compile the “julia_gpu.cu” example in the “CUDA by example” textbook and encounter the following problem:
the command “nvcc -o julia_gpu julia_gpu.cu” returns the error message
/tmp/tmpxft_00000a99_00000000-13_julia_gpu.o: In function `CPUBitmap::display_and_exit(void (*)(void*))':
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x4e): undefined reference to `glutInit'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x58): undefined reference to `glutInitDisplayMode'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x6f): undefined reference to `glutInitWindowSize'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x79): undefined reference to `glutCreateWindow'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x83): undefined reference to `glutKeyboardFunc'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x8d): undefined reference to `glutDisplayFunc'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x92): undefined reference to `glutMainLoop'
/tmp/tmpxft_00000a99_00000000-13_julia_gpu.o: In function `CPUBitmap::Draw()':
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x27): undefined reference to `glClearColor'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x31): undefined reference to `glClear'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x5c): undefined reference to `glDrawPixels'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x61): undefined reference to `glFlush'
collect2: ld returned 1 exit status
I have libglut3 installed and can locate the gl.h, glu.h, glut.h etc. in /usr/include/GL.
I also tried “nvcc -o julia_gpu julia_gpu.cu -Iglut” and “nvcc -o julia_gpu julia_gpu.cu -IGL -Iglut” but get the same error message.
I’m trying to compile the “julia_gpu.cu” example in the “CUDA by example” textbook and encounter the following problem:
the command “nvcc -o julia_gpu julia_gpu.cu” returns the error message
/tmp/tmpxft_00000a99_00000000-13_julia_gpu.o: In function `CPUBitmap::display_and_exit(void (*)(void*))':
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x4e): undefined reference to `glutInit'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x58): undefined reference to `glutInitDisplayMode'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x6f): undefined reference to `glutInitWindowSize'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x79): undefined reference to `glutCreateWindow'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x83): undefined reference to `glutKeyboardFunc'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x8d): undefined reference to `glutDisplayFunc'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x92): undefined reference to `glutMainLoop'
/tmp/tmpxft_00000a99_00000000-13_julia_gpu.o: In function `CPUBitmap::Draw()':
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x27): undefined reference to `glClearColor'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x31): undefined reference to `glClear'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x5c): undefined reference to `glDrawPixels'
tmpxft_00000a99_00000000-1_julia_gpu.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x61): undefined reference to `glFlush'
collect2: ld returned 1 exit status
I have libglut3 installed and can locate the gl.h, glu.h, glut.h etc. in /usr/include/GL.
I also tried “nvcc -o julia_gpu julia_gpu.cu -Iglut” and “nvcc -o julia_gpu julia_gpu.cu -IGL -Iglut” but get the same error message.
Thanks xen_! I was a little stuck on this too. Just out of curiosity, did you learn those flags from the book or was that discovery from somewhere else? Cheers.