Closed HellGL closed 3 years ago
I test missing symbols, too, using ldd -r
on Linux in the Docker environment as I don't have a Linux computer. And I got used to seeing the OpenGL symbols as missing. I don't see pthread
missing. It is either covered by other libraries or another thread solution is included.
I don't build LiveTraffic on Windows with CMake but with the separately provided VC++ project. I haven't found a mingw setup in Docker that includes all required C++ 17 libraries and headers in a workable way.
Googling a bit I changed to using the import targets:
# Link OpenGL and OpenAL related libraries.
set (OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED COMPONENTS OpenGL) # apt install freeglut3-dev
if ( OpenGL_FOUND )
add_dependencies( LiveTraffic OpenGL::OpenGL )
include_directories( ${OpenGL_INCLUDE_DIRS} )
target_link_libraries( LiveTraffic OpenGL::OpenGL )
endif( OpenGL_FOUND )
This does indeed no longer list the OpenGL symbols as missing in the ldd -r
output.
The above way causes startup issues, apparently the old way of leaving library resolution to runtime was a better idea.
Never touch a running system...change to be rolled back:
Not really a bug as LiveTraffic works anyway. FindOpenGL works different on different systems: https://github.com/TwinFan/LiveTraffic/blob/44f2cfd47843ff891cf2c58343bc80700946ec8c/CMakeLists.txt#L197-L203 On my Linux system (OpenSuSE 15.1) it sets
OPENGL_INCLUDE_DIR
andOPENGL_opengl_LIBRARY
and on Windows (mingw64) it sets onlyOPENGL_gl_LIBRARY
and no include path.As openGL is loaded dynamically during runtime LiveTraffic compiles and runs without these definitions. For completeness during compilation they should be included however. I usually test for undefined references (beyond the XPLM ones) by running the linker command without "-shared". Adding
2>&1 |grep undefined | grep -v XPLM
to the the command line should only show "main" or "WinMain" as it is a shared library. Very useful to find object files that are compiled and referenced, but not linked...BTW: pthread is also not in the linker command.