I'm currently attempting to rebuild FlightGear on my Ubuntu 14.04 machine. Everything went smoothly until I decided to build fgrun
which requires Qt. I decided to compile Qt as a static library since I didn't want self-built libraries overrunning any on the system.
I statically built Qt on the system like so:
./configure -static -opensource -nomake tests -gtkstyle -prefix /home/user/Qt/5.4/Src/qtbuild -no-rpath -no-compile-examples -system-proxies -skip qtwebkit -skip qtwebkit-examples -nomake tools -nomake examples -skip script -release -skip multimedia -verbose -l dl -skip location -skip multimedia -skip quick1 -skip quickcontrols -skip sensors -skip serialport -skip svg -skip tools -skip translations -skip wayland -skip webchannel -skip webengine -skip xmlpatterns -skip activeqt -skip connectivity -skip declarative -skip doc -skip enginio -skip graphicaleffects -skip imageformats -skip websockets
I showed FlightGear's CMake where to find the libraries and everything appeared fine until the final linking stage:
Linking CXX executable fgfs
/usr/bin/ld: /home/user/Qt/5.4/Src/qtbuild/lib/libQt5Core.a(qlibrary_unix.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
Now, I've run into this issue before and it was a matter of not linking the the dynamic linker library via -ldl
. However, I've ensured that both Qt and FlightGear are built with the -ldl
flag, yet I still get this error.
So now, this begs the question in my mind: is it even possible to dynamically link from a static library? I would imagine that -ldl would have to be included in the static library which would be a Bad Idea, is this correct?