Gentoo Archives: gentoo-user

From: Andrea Conti <alyf@××××.net>
To: gentoo-user@l.g.o
Subject: Re: Aw: [gentoo-user] Re: Some essential packages fail to compile
Date: Sat, 08 Sep 2012 19:39:54
Message-Id: 504B9E8C.5090005@alyf.net
In Reply to: Aw: [gentoo-user] Re: Some essential packages fail to compile by "Roland Häder"
1 > One way is (if you have read any 'environment' files in my tar archive) to set the guest architecture explitcitly in /etc/(portage/)make.conf which I did.
2 >
3 > /etc/make.conf:
4 > CFLAGS="-O2 -march=i686 -pipe -fPIC -m32"
5 > CXXFLAGS="${CFLAGS}"
6 > CHOST="i486-pc-linux-gnu"
7
8 That is not "setting the guest architecture explicitly", you're just
9 telling whatever compiler gets invoked on the remote host to produce
10 32-bit output.
11
12 Cross-compiling with distcc is quite straightforward. As long as distcc
13 is setup correctly on the client (which for cross-compiling involves a
14 manual step, see below), and as long as the ebuilds properly invoke the
15 compiler with the CHOST prefix (i.e. 'i486-pc-linux-gnu-gcc' instead of
16 'gcc'), the appropriate compiler will be called on the servers, with no
17 need to manually play with your CFLAGS.
18
19 If you need -m32, it means you are *not* cross-compiling, i.e. you are
20 invoking the native gcc on the remote hosts instead of your
21 cross-compiler. That usually works as any x86_84 gcc with multilib
22 support can produce 32-bit output, but it is just masking the problem
23 and will break if the -m32 flag is lost for some reason.
24
25 > I left the default CHOST as is and on the Debian systems I provided the required compiler.
26
27 "provided the required compiler" should mean that on every server you
28 have a complete 32-bit toolchain (binutils, gcc, glibc and kernel
29 headers) with the version of each component matching those on your
30 distcc client. You should be able to compile a 32-bit executable locally
31 on any of the Debian systems just by invoking 'i486-pc-linux-gnu-gcc'.
32
33 Setting up such a toolchain can be quite a PITA, so on Gentoo it's
34 usually done with crossdev -- but as long as you get things right that's
35 not a requirement.
36
37 > One of the nodes has compiled a 64 bit object (conf.o) which the linker (running on 32 bit) tried to link to a 32 bit program/library (the output).
38 > So for me, the Makefile in that package (klibc) didn't provide the specified CFLAGS I configured which needs fixing, if my assuming is right. I can deeper more investigate here.
39 > export HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
40 > I think this line only needs to be extended with $(CFLAGS) then the fix is complete.
41
42 No. CFLAGS are for the build target, HOSTCFLAGS are for the build host.
43 Building (configuring, actually) klibc involves compiling a tool which
44 is run on the host (i.e. the machine you're building on), before
45 compiling klibc itself for the build target.
46 In your case both the host and the target are the same
47 (i486-pc-linux-gnu), so the difference might not be very clear, but if
48 you were compiling klibc for a different arch (e.g. powerpc) you would
49 have a completely different build target, with its set of CFLAGS.
50
51 Back to your problem, the klibc build is correctly picking up your HOSTCC:
52
53 >>>> Source unpacked in /var/tmp/portage/dev-libs/klibc-1.5.20/work
54 >>>> Compiling source in /var/tmp/portage/dev-libs/klibc-1.5.20/work/klibc-1.5.20 ...
55 > make -j6 defconfig CC=i486-pc-linux-gnu-gcc HOSTCC=i486-pc-linux-gnu-gcc
56
57 but distcc seems to be invoking the native x86_64 compiler (i.e. 'gcc')
58 on the remote systems (you can also see all those warnings about
59 differing integer and pointer sizes).
60
61 My guess is that you didn't set up properly distcc for cross-compiling
62 on your client. Try following the instructions at
63
64 http://www.gentoo.org/doc/en/cross-compiling-distcc.xml
65
66 and let us know if it fixes your problem.
67
68 HTH,
69 andrea

Replies

Subject Author
Aw: Re: [gentoo-user] Re: Some essential packages fail to compile "Roland Häder" <r.haeder@×××.de>