Gentoo Archives: gentoo-user

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Problems with cross-compiling
Date: Sun, 27 Mar 2016 08:42:25
Message-Id: 20160327114155.51a31aa3f0401ee02a77e42a@gentoo.org
In Reply to: [gentoo-user] Problems with cross-compiling by Dan Johansson
1 Опц
2
3 On Fri, 25 Mar 2016 13:35:47 +0100 Dan Johansson wrote:
4 > I have setup one of my VM's to do cross-compiling for my Raspberry PI 2.
5 > Now some packages (e.g. app-editors/vim and its dependencies) emerges
6 > fine while other (e.g. net-misc/wget or rather one of its dependencies
7 > dev-libs/libpcre-8.38:3) does not.
8
9 Cross-compilation is a pain, really. Probably it will be easier and
10 faster to emulate CPU using qemu. Of course, if you'll go on the
11 road of cross-compiling and will send patches, this will be a great
12 enhancement for others.
13
14 > What I have done is this:
15 > # emerge sys-devel/crossdev
16 > (installed sys-devel/crossdev-20150716)
17 >
18 > # crossdev -S -P -v -t armv7a-hardfloat-linux-gnueabi
19 > (which "installed" fine without any errors)
20 >
21 > # armv7a-hardfloat-linux-gnueabi-emerge --verbose --oneshot
22 > =net-misc/wget-1.16.3-r1
23 >
24 > Which pulls in dev-libs/libpcre-8.38:3::gentoo which then fails with this:
25 >
26 > ln -sf pcre_compile2.3
27 > /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/libpcre-8.38/image//usr/share/man/man3/pcre16_compile2.3
28 > /usr/libexec/gcc/armv7a-hardfloat-linux-gnueabi/ld: skipping
29 > incompatible /usr/lib/libpthread.so when searching for -lpthread
30 > /usr/libexec/gcc/armv7a-hardfloat-linux-gnueabi/ld: skipping
31 > incompatible /usr/lib/libc.so when searching for -lc
32 > /usr/lib/libc.a: error adding symbols: File format not recognized
33 > collect2: error: ld returned 1 exit status
34
35 The problem is that build system tries to utilize system libraries
36 (libc, libpthread) instead of cross-compiled versions. You should
37 modify it in order to provide correct path, e.g. by passing a proper
38 --sysroot=... to a linker.
39
40
41 Best regards,
42 Andrew Savchenko