You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS: Ubuntu 22.04
Since I have built the project in a Cluster, I have no root privilege. Then it is need to specific relevant library path.
I use CMake to build the glew: cmake -DCMAKE_INSTALL_PREFIX=~/usr/local/ -DOPENGL_opengl_LIBRARY=/usr/lib/x86_64-linux-gnu/libOpenGL.so.0 -DOPENGL_glx_LIBRARY=/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0 -DOPENGL_INCLUDE_DIR=/usr/include/ -DX11_LIBRARIES=/home/c/chenggan/usr/local/lib/libX11.so -DX11_INCLUDE_DIR=/home/c/chenggan/usr/local/include/ ./cmake
Then make:
I got:
(base) chenggan@xlogin2:~/lib/glew-2.2.0/build$ make
[ 12%] Building C object CMakeFiles/glew.dir/home/c/chenggan/lib/glew-2.2.0/src/glew.c.o
[ 25%] Linking C shared library lib/libGLEW.so
[ 25%] Built target glew
[ 37%] Building C object CMakeFiles/glew_s.dir/home/c/chenggan/lib/glew-2.2.0/src/glew.c.o
[ 50%] Linking C static library lib/libGLEW.a
[ 50%] Built target glew_s
[ 62%] Building C object CMakeFiles/glewinfo.dir/home/c/chenggan/lib/glew-2.2.0/src/glewinfo.c.o
[ 75%] Linking C executable bin/glewinfo
/usr/bin/ld: CMakeFiles/glewinfo.dir/home/c/chenggan/lib/glew-2.2.0/src/glewinfo.c.o: in function glewCreateContext': glewinfo.c:(.text+0x21c87): undefined reference to glXQueryExtension'
/usr/bin/ld: glewinfo.c:(.text+0x21d2a): undefined reference to glXCreateContext' /usr/bin/ld: glewinfo.c:(.text+0x21de6): undefined reference to glXMakeCurrent'
/usr/bin/ld: glewinfo.c:(.text+0x21f9b): undefined reference to glXMakeCurrent' /usr/bin/ld: glewinfo.c:(.text+0x21fb2): undefined reference to glXDestroyContext'
/usr/bin/ld: glewinfo.c:(.text+0x21fd7): undefined reference to glXChooseVisual' /usr/bin/ld: CMakeFiles/glewinfo.dir/home/c/chenggan/lib/glew-2.2.0/src/glewinfo.c.o: in function glewDestroyContext':
glewinfo.c:(.text+0x22041): undefined reference to glXDestroyContext' /usr/bin/ld: lib/libGLEW.so.2.2.0: undefined reference to glXGetProcAddressARB'
/usr/bin/ld: lib/libGLEW.so.2.2.0: undefined reference to glXQueryVersion' /usr/bin/ld: lib/libGLEW.so.2.2.0: undefined reference to glXGetClientString'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/glewinfo.dir/build.make:102: bin/glewinfo] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/glewinfo.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
I should have run make extension to have glxew.h in the include/GL folder.
The text was updated successfully, but these errors were encountered:
nigels-com
changed the title
Undefined reference to glx functions when build with non-standard prefix path
cmake: Undefined reference to glx functions when build with non-standard prefix path
Apr 24, 2024
OS: Ubuntu 22.04
Since I have built the project in a Cluster, I have no root privilege. Then it is need to specific relevant library path.
I use CMake to build the glew:
cmake -DCMAKE_INSTALL_PREFIX=~/usr/local/ -DOPENGL_opengl_LIBRARY=/usr/lib/x86_64-linux-gnu/libOpenGL.so.0 -DOPENGL_glx_LIBRARY=/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0 -DOPENGL_INCLUDE_DIR=/usr/include/ -DX11_LIBRARIES=/home/c/chenggan/usr/local/lib/libX11.so -DX11_INCLUDE_DIR=/home/c/chenggan/usr/local/include/ ./cmake
Then
make
:I got:
I should have run
make extension
to haveglxew.h
in the include/GL folder.The text was updated successfully, but these errors were encountered: