This is the mail archive of the
mailing list for the binutils project.
Re: Spurious undefined reference error?
On Thu, Dec 20, 2012 at 12:00 PM, H.J. Lu <firstname.lastname@example.org> wrote:
>> The problem was not present on ubuntu 10.04
> I think Ubuntu changed linker command-line options passed from GCC
> driver. Please compare the linker command-line options
On ubuntu 12.04, the extra options
appear on the collect2 commandline.
Adding -Wl,--no-add-needed -Wl,--as-needed to the g++ commandline on
ubuntu 10.04 replicates the link failure on the previously working
Adding -Wl,--no-as-needed on ubuntu 12.04 works around the problem.
On 10.04, 'readelf -d /opt/foo/bar/lib/libxxx3.so | grep NEEDED' showed
0x0000000000000001 (NEEDED) Shared library: [libxxx6++.so.2]
On 12.04, it didn't.
Adding the needed dependency in the Makefile for libxxx3
caused the NEEDED flag to appear, but that didn't seem solve the
even though from the doc for --as-needed, I would have thought it would.
( see thread http://sourceware.org/ml/binutils/2009-01/msg00413.html )
I'd kind of like to not need to pass --no-as-needed. I suppose the
next step is a small test case.