public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Dan Kegel <dank@kegel.com>
To: binutils@sourceware.org
Subject: Spurious undefined reference error?
Date: Thu, 20 Dec 2012 19:22:00 -0000	[thread overview]
Message-ID: <CAPF-yOaSkoNNH=aPQuzWtvRYP=K5emyBKMwu6A747VTHR92vZQ@mail.gmail.com> (raw)

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.)

             reply	other threads:[~2012-12-20 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20 19:22 Dan Kegel [this message]
2012-12-20 19:48 ` Dan Kegel
2012-12-20 20:00   ` H.J. Lu
2012-12-20 23:19     ` Dan Kegel
2013-01-08  6:10       ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPF-yOaSkoNNH=aPQuzWtvRYP=K5emyBKMwu6A747VTHR92vZQ@mail.gmail.com' \
    --to=dank@kegel.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).