JoeyDeVries / LearnOpenGL

Code repository of all OpenGL chapters from the book and its accompanying website https://learnopengl.com
https://learnopengl.com
Other
10.81k stars 2.77k forks source link

Ubuntu 14.04 make error #79

Open zhaoch86 opened 7 years ago

zhaoch86 commented 7 years ago

andyzhao@ANDYZHAO_PRECISION_5510 ~/LearnOpenGL> make [ 1%] Building C object CMakeFiles/GLAD.dir/src/glad.c.o Linking C static library libGLAD.a [ 1%] Built target GLAD [ 2%] Building CXX object CMakeFiles/STB_IMAGE.dir/src/stb_image.cpp.o Linking CXX static library libSTB_IMAGE.a [ 2%] Built target STB_IMAGE [ 3%] Building CXX object CMakeFiles/1.getting_started1.1.hello_window.dir/src/1.getting_started/1.1.hello_window/hello_window.cpp.o Linking CXX executable bin/1.getting_started/1.getting_started1.1.hello_window /usr/bin/ld: libGLAD.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: [bin/1.getting_started/1.getting_started__1.1.hello_window] Error 1 make[1]: [CMakeFiles/1.getting_started__1.1.hello_window.dir/all] Error 2 make: *** [all] Error 2

wangcan26 commented 7 years ago

This problem occurs due to not linking -dl properly.

just remove dl in line "set(LIBS ${GLFW3_LIBRARY} X11 Xrandr Xinerama Xi Xxf86vm Xcursor GL dl pthread assimp)" of the CMakeLists.txt

and add

"set(LIBS $(LIBS) dl)" after line "set(LIBS ${LIBS} GLAD)"

This modification just solves my problem

zuck commented 6 years ago

See workaround posted on #64.