GLE icon indicating copy to clipboard operation
GLE copied to clipboard

4.3.3 fails to compile with GCC on Linux

Open adalbosco opened this issue 2 years ago • 3 comments

It fails at the linkage phase with the following message:

x86_64-pc-linux-gnu/bin/ld: gui/CMakeFiles/qgle.dir/qgslibloader.cpp.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib/libdl.so.2: error adding symbols: DSO missing from command line

That means the "linker library" (dl) is missing, i.e., "-ldl" should be added to the linkage command line. With CMake, this can be done by adding ${CMAKE_DL_LIBS} to the appropriate target_link_libraries. I don't know where is the best place in GLE's CMakeLists.txt file to add it, but I added where it seemed right and it solved the problem.

I don't know if this problem happens with other compiles on Linux or how it affects compilation on Mac and Windows, but given the fact that we are using a CMake variable, I figured it's probably safe to put it where I put it, as CMake should fill it with the appropriate value according to the environment.

Here is a patch to src/gui/CMakeLists.txt.

By the way, in case anybody is wondering, this issue hasn't been fixed with commit 0cb9c643. I tried the git HEAD source and the problem still exists.

adalbosco avatar Mar 04 '23 02:03 adalbosco

Thanks for the fix. Getting the linking right can be fussy on Linux. Could you submit a pull request with the new code? It will be easier for me to integrate it into the source code.

vlabella avatar Mar 04 '23 02:03 vlabella

Here you are https://github.com/vlabella/GLE/pull/8

adalbosco avatar Mar 04 '23 03:03 adalbosco

The PR was merged so this issue could be closed.

ryandesign avatar Jul 26 '24 12:07 ryandesign