library linking problems with multiarch cross-building

2012-10-05 Thread peter green
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-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/506f6d07.7090...@postgrad.manchester.ac.uk



Re: library linking problems with multiarch cross-building

2012-10-05 Thread Steve Langasek
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
:

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 Developerhttp://www.debian.org/
slanga...@ubuntu.com vor...@debian.org


signature.asc
Description: Digital signature