This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Spurious undefined reference error?

On Thu, Dec 20, 2012 at 12:00 PM, H.J. Lu <> 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
  --no-add-needed --as-needed
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/ | grep NEEDED' showed
 0x0000000000000001 (NEEDED)             Shared library: []
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
linking problem,
even though from the doc for --as-needed, I would have thought it would.
( see thread )

I'd kind of like to not need to pass --no-as-needed.  I suppose the
next step is a small test case.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]