Linking error due to binutils default changes


#1

I’m using Arch Linux, which is very recent. This only means that I notice issues ealier than, say, ubuntu.

binutils release notes:
http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/ld/NEWS?rev=1.121&content-type=text/plain&cvsroot=src&only_with_tag=binutils-binutils-2_22

What this means is that indirect linking doesn’t work anymore, hence juce example application Makefiles don’t work anymore.
-ldl -lXext is missing in a number of those.

Example output:
Compiling JuceLibraryCode1.cpp
Compiling JuceLibraryCode2.cpp
Compiling JuceLibraryCode3.cpp
Compiling JuceLibraryCode4.cpp
In file included from …/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/linux/juce_linux_NativeCode.cpp:104:0,
from …/…/JuceLibraryCode/…/…/…/amalgamation/juce_amalgamated_template.cpp:412,
from …/…/JuceLibraryCode/…/…/…/amalgamation/juce_amalgamated4.cpp:31,
from …/…/JuceLibraryCode/JuceLibraryCode4.cpp:15:
…/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/linux/…/common/juce_posix_SharedCode.h: In member function ‘void juce::FileInputStream::openHandle()’:
…/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/linux/…/common/juce_posix_SharedCode.h:426:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
…/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/linux/…/common/juce_posix_SharedCode.h: In member function ‘void juce::FileOutputStream::openHandle()’:
…/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/linux/…/common/juce_posix_SharedCode.h:471:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
…/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/linux/…/common/juce_posix_SharedCode.h:489:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
Linking Juce Demo
/usr/bin/ld: build/intermediate/Release/JuceLibraryCode4_6856d902.o: undefined reference to symbol ‘dlclose@@GLIBC_2.2.5
/usr/bin/ld: note: ‘dlclose@@GLIBC_2.2.5’ is defined in DSO /lib/libdl.so.2 so try adding it to the linker command line
/lib/libdl.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [build/JuceDemo] Error 1


#2

I managed to build a first project, the introjucer generated empty window.
The Introjucer generated Makefile did contain -lXext but lacked -ldl. After adding -ldl manually it built and worked fine.