This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: compile failure due to undefined symbol
- From: Nick Clifton <nickc at redhat dot com>
- To: "Peter S. Mazinger" <ps dot m at gmx dot net>
- Cc: Alan Modra <amodra at bigpond dot net dot au>, binutils at sourceware dot org
- Date: Tue, 02 Oct 2007 11:57:03 +0100
- Subject: Re: compile failure due to undefined symbol
- References: <Pine.LNX.4.44.0709281519570.3230-201000@lnx.bridge.intra>
Hi Peter,
Attached you'll find what I used
I could not get that patch to work for me. (The inclusion of -lbfd-${VERSION}
did not work because VERSION only expanded into -lbfd-2.18.50 and not
-lbfd-2.18.50-20071002, and the definition of BFDLIB had only one back-tick not
two).
But I was able to use it as the basis for a patch which did work. Would you
like to try it out and see what you think ? (The patch is attached, but I have
not included the regenerated files. I assume that you are OK to recreate them
yourself). I chose to use -rpath rather than -rpath-link and then to
explicitly link into the shared bfd library rather than using the library
location mechanism as this appeared to do the right thing.
Cheers
Nick
Index: opcodes/configure.in
===================================================================
RCS file: /cvs/src/src/opcodes/configure.in,v
retrieving revision 1.78
diff -c -3 -p -r1.78 configure.in
*** opcodes/configure.in 9 Sep 2007 01:22:57 -0000 1.78
--- opcodes/configure.in 2 Oct 2007 10:18:23 -0000
*************** AC_SUBST(cgendir)
*** 97,115 ****
using_cgen=no
! # Horrible hacks to build DLLs on Windows.
! WIN32LDFLAGS=
! WIN32LIBADD=
! case "${host}" in
! *-*-cygwin*)
! if test "$enable_shared" = "yes"; then
! WIN32LDFLAGS="-no-undefined"
! WIN32LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
! fi
! ;;
! esac
! AC_SUBST(WIN32LDFLAGS)
! AC_SUBST(WIN32LIBADD)
# target-specific stuff:
--- 97,122 ----
using_cgen=no
! # Horrible hacks to build DLLs on Windows and a shared library elsewhere.
! SHARED_LDFLAGS=
! SHARED_LIBADD=
! SHARED_DEPENDENCIES=
! if test "$enable_shared" = "yes"; then
! case "${host}" in
! *-*-cygwin*)
! SHARED_LDFLAGS="-no-undefined"
! SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
! ;;
! *)
! SHARED_LDFLAGS="-Wl,-z,defs"
! SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so"
! SHARED_DEPENDENCIES="`pwd`/../bfd/.libs/libbfd.so"
! ;;
! esac
! fi
! AC_SUBST(SHARED_LDFLAGS)
! AC_SUBST(SHARED_LIBADD)
! AC_SUBST(SHARED_DEPENDENCIES)
# target-specific stuff:
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.121
diff -c -3 -p -r1.121 Makefile.am
*** opcodes/Makefile.am 14 Sep 2007 19:28:56 -0000 1.121
--- opcodes/Makefile.am 2 Oct 2007 10:18:23 -0000
*************** libopcodes_la_SOURCES = dis-buf.c disas
*** 367,376 ****
# Unfortunately this causes libtool to add -L$(libdir), referring to the
# planned install directory of libbfd. This can cause us to pick up an
# old version of libbfd, or to pick up libbfd for the wrong architecture
! # if host != build.
! libopcodes_la_DEPENDENCIES = $(OFILES)
! libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@
! libopcodes_la_LDFLAGS = -release `cat ../bfd/libtool-soversion` @WIN32LDFLAGS@
# libtool will build .libs/libopcodes.a. We create libopcodes.a in
# the build directory so that we don't have to convert all the
--- 367,377 ----
# Unfortunately this causes libtool to add -L$(libdir), referring to the
# planned install directory of libbfd. This can cause us to pick up an
# old version of libbfd, or to pick up libbfd for the wrong architecture
! # if host != build. So for building with shared libraries we use a
! # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la.
! libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
! libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
! libopcodes_la_LDFLAGS = -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
# libtool will build .libs/libopcodes.a. We create libopcodes.a in
# the build directory so that we don't have to convert all the