This is the mail archive of the binutils@sourceware.org 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]

Spurious undefined reference error?


The command (sanitized)

g++ -Wl,--verbose -v -pthread videos.C -Wl,-rpath,/opt/foo/bar/lib
-L/opt/foo/bar/lib \
-lxxx3 -lxxx6++ -llxxx7++ -lxxx6 -lxxx7 ../xxx8/xxx8.a -o videos

fails for me with

found libxxx6++.so at /opt/foo/bar/lib/libxxx6++.so
/usr/local/bin/ld: /opt/foo/bar/lib/libxxx3.so: undefined reference to
symbol 'foo::xxx6::bletch() const'
/usr/local/bin/ld: note: 'foo::xxx6::bletch() const' is defined in DSO
/opt/foo/bar/lib/libxxx6++.so so try adding it to the linker command
line

The commandline

g++ -Wl,--verbose -v -pthread videos.C -Wl,-rpath,/opt/foo/bar/lib
-L/opt/foo/bar/lib \
-lxxx3 -lxxx6++ -llxxx7++ -lxxx6 -lxxx7 ../xxx8/xxx8.a
/opt/foo/bar/lib/libxxx6++.so -o videos

works.

Why, if it was able to find the library, can't it use it without an
absolute path?

ld --version says 2.22; this is the stock linker on ubuntu 12.04 x86-64.

(Building a fresh binutils-2.23 from source in /usr/local doesn't seem
to help.... probably because even /usr/local/bin/ld --version still
says 2.22 then, so evidently it's not that easy to replace binutils.
A clue on how to gather more info would be appreciated.)


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