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
|