Linux: Linking with static Qt fails
I am attempting to build FlightGear on an Ubuntu 14.04 system. Unfortunately, the Ubuntu 14.04 Qt libraries are not up to par for what is required for FlightGear. Since I will only be using this Qt build for this single application, I opted for a static build.
I used the following configure command:
./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
The compile appear to work just fine, but as soon as I attempt build FlightGear I get the following error at the linking stage:
Linking CXX executable fgfs
/usr/bin/ld: /home/charles/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
This appears to be an error with my static Qt build not being linked to libdl.so -- or something? The above configure command is not my original. I had added
-l dlin order to fix the problem, but to no avail. Any help at all would be appreciated!
I suppose I got it sorted by adding an -ldl flag in the FlightGear compile. Strangely enough, the first time I tried it it didn't work at all. I tried it again and it magically worked. Now I'm going to be building/rebuilding for the next several hours just to figure out how exactly I fixed it...