This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: libiberty reports: "undefined reference to dlopen"
On Tue, Jul 03, 2001 at 04:16:32PM -0400, Jeff W. wrote:
> I tried compiling a program that depends on libiberty, and I got these
> messages when compiling:
>
> g++ -I../include -w -I/usr/local/dyninst/core/dyninstAPI/h
> tau_run.cpp -o tau_run -L/usr/local/dyninst/lib/ -ldyninstAPI -liberty
> -lelf
> /usr/lib/libiberty.a(cplus-dem.o): In function `init_demangler':
> cplus-dem.o(.text+0xae7): undefined reference to `dlopen'
> cplus-dem.o(.text+0xaf6): undefined reference to `dlerror'
> cplus-dem.o(.text+0xb1b): undefined reference to `dlsym'
> cplus-dem.o(.text+0xb2c): undefined reference to `dlerror'
> collect2: ld returned 1 exit status
>
> I'm on a Debian system. I had installed the latest stable release of
> binutils-dev, still got the above messages, so grabbed the newest tarball
> of it (2.11.something, newer than the debs), and am still getting the same
> error. I'm assuming I've just done something retarded as opposed to it
> being a bug in libiberty. Does anyone know what might be the
> problem? Thanks.
It looks like Debian uses a strange binutils. As far as I know,
those dlxxx functions are only used in my Linux binutils. But in
my Linux binutils, they shiuld be marked as weak undefined:
# objdump --sym /usr/lib/libiberty.a | grep " dl"
0000000000000000 w *UND* 0000000000000000 dlopen
0000000000000000 w *UND* 0000000000000000 dlerror
0000000000000000 w *UND* 0000000000000000 dlsym
so that linker won't complain if they don't exist.
H.J.