Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Development (http://www.linux-archive.org/debian-development/)
-   -   library linking problems with multiarch cross-building (http://www.linux-archive.org/debian-development/709986-library-linking-problems-multiarch-cross-building.html)

peter green 10-05-2012 11:28 PM

library linking problems with multiarch cross-building
 
My previous experiments with multiarch cross-building had run into lots
of build-dependency and tool problems and as a result I hadn't got
arround to actually building anything beyond trivial test programs.


Unfortunately I have now discovered that when I try to link against
some libraries I get link errors.


root@debian:/# arm-linux-gnueabihf-gcc test.c -lglib-2.0
/usr/lib/gcc/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
warning: libpcre.so.3, needed by
/usr/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using -rpath
or -rpath-link)
/usr/lib/gcc/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
warning: libpthread.so.0, needed by
/usr/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using -rpath
or -rpath-link)
/usr/lib/gcc/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
warning: librt.so.1, needed by
/usr/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using -rpath
or -rpath-link)
/usr/lib/arm-linux-gnueabihf/libglib-2.0.so: undefined reference to
`pthread_rwlock_wrlock@GLIBC_2.4'


Any thoughts on what could be causing this and how best to fix it?


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 506F6D07.7090700@postgrad.manchester.ac.uk">http://lists.debian.org/506F6D07.7090700@postgrad.manchester.ac.uk

Steve Langasek 10-06-2012 12:23 AM

library linking problems with multiarch cross-building
 
Hi Peter,

On Sat, Oct 06, 2012 at 12:28:07AM +0100, peter green wrote:
> My previous experiments with multiarch cross-building had run into
> lots of build-dependency and tool problems and as a result I hadn't
> got arround to actually building anything beyond trivial test
> programs.

> Unfortunately I have now discovered that when I try to link against
> some libraries I get link errors.

> root@debian:/# arm-linux-gnueabihf-gcc test.c -lglib-2.0
> /usr/lib/gcc/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
> warning: libpcre.so.3, needed by
> /usr/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using
> -rpath or -rpath-link)
> /usr/lib/gcc/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
> warning: libpthread.so.0, needed by
> /usr/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using
> -rpath or -rpath-link)
> /usr/lib/gcc/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
> warning: librt.so.1, needed by
> /usr/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using
> -rpath or -rpath-link)
> /usr/lib/arm-linux-gnueabihf/libglib-2.0.so: undefined reference to
> `pthread_rwlock_wrlock@GLIBC_2.4'

> Any thoughts on what could be causing this and how best to fix it?

This is a bug in the cross compiler that you're using. You can work around
it by passing this option to gcc:

-Wl,-rpath-link=/usr/lib/arm-linux-gnueabihf:/lib/arm-linux-gnueabihf:/usr/lib

To work around this class of bug when doing package builds, you can use the
standard DEB_LDFLAGS_APPEND interface, as described at
<https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingMultiArch>:

export DEB_LDFLAGS_APPEND="-L/usr/lib/arm-linux-gnueabi -L/lib/arm-linux-gnueabi -L/usr/lib -Wl,-rpath-link=/usr/lib/arm-linux-gnueabi:/lib/arm-linux-gnueabi:/usr/lib"

HTH,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@ubuntu.com vorlon@debian.org


All times are GMT. The time now is 02:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.