Gentoo Archives: gentoo-user

From: "Roland Häder" <r.haeder@×××.de>
To: gentoo-user@l.g.o
Subject: Aw: Re: [gentoo-user] Re: Some essential packages fail to compile
Date: Sat, 08 Sep 2012 20:46:15
Message-Id: trinity-b9b05d88-5048-4b05-a9d0-f88c5e56f86c-1347137010528@3capp-webde-bs10
In Reply to: Re: Aw: [gentoo-user] Re: Some essential packages fail to compile by Andrea Conti
1 > > CFLAGS="-O2 -march=i686 -pipe -fPIC -m32"
2 > > CXXFLAGS="${CFLAGS}"
3 > > CHOST="i486-pc-linux-gnu"
4 I have reformated my disk because I missed a parameter (-d . or so) which would make it possible for dracut to use gpg key decryption. Now I have to reinstall all from scratch (including configuring kernel). In the meanwhile I figured out that I choosed the wrong stage3 file (i486 instead of i686) (I have downloaded http://de-mirror.org/gentoo/releases/x86/current-stage3/stage3-i686-20120710.tar.bz2 + http://de-mirror.org/gentoo/snapshots/portage-latest.tar.bz2 now) which I could fix now. So now CHOST="i686-pc-linux-gnu" is set.
5
6 > That is not "setting the guest architecture explicitly", you're just
7 > telling whatever compiler gets invoked on the remote host to produce
8 > 32-bit output.
9 Guest from the other node's view. ;) Okay, to stop confusion:
10
11 Node name | Distri | Architecture
12 ------------------------------------------------------------
13 daedalus | Debian Unstable | AMD64 (with multilib support)
14 router | Debian Unstable | AMD64 (same)
15 laptop | Gentoo | x86 (i686, reinstallation)
16 ------------------------------------------------------------
17
18 One think I also need that 'daedalus' or 'router' can start 64 and 32 bit compilations (e.g. wine should be better 32 bit, other games I play with are 64 bit compiled) which I would like to have. Most of these build systems sadly (!) call gcc and g++ (both aliases), so I had to add -m32 for 32 bit apps/libs.
19
20 If I fully follow that wiki page (I did until the wrapper script is added) I would have to change these links:
21
22 lrwxrwxrwx 1 root root 16 Sep 6 21:35 c++ -> ../../bin/distcc
23 lrwxrwxrwx 1 root root 16 Sep 6 21:35 cc -> ../../bin/distcc
24 lrwxrwxrwx 1 root root 16 Sep 6 21:35 g++ -> ../../bin/distcc
25 lrwxrwxrwx 1 root root 16 Sep 6 21:35 gcc -> ../../bin/distcc
26
27 ... to the wrapper scripts which (I think so) will make it impossible to compile 64 bits.
28
29 In my view my "fix" by adding explicitly the -m32 -march=xxxx flags may help here better, as long as all packages are honoring them (which most do, except those with x86_64 problems).
30
31 > If you need -m32, it means you are *not* cross-compiling, i.e. you are
32 > invoking the native gcc on the remote hosts instead of your
33 > cross-compiler. That usually works as any x86_84 gcc with multilib
34 > support can produce 32-bit output, but it is just masking the problem
35 > and will break if the -m32 flag is lost for some reason.
36 Yes, i686-pc-linux-gnu-gcc and i686-pc-linux-gnu-g++ are just symbolic links to the native compilers (because I don't have those binaries).
37
38 Here is a list:
39 ------------------------------------------------------
40 daedalus:/usr/bin# ls -l i686-pc-linux-gnu-g*
41 lrwxrwxrwx 1 root root 7 Sep 8 18:55 i686-pc-linux-gnu-g++ -> g++-4.7
42 lrwxrwxrwx 1 root root 7 Sep 8 18:55 i686-pc-linux-gnu-gcc -> gcc-4.7
43 ------------------------------------------------------
44
45 I have now the g++-multilib and gcc-multilib packages installed on 'daedalus' and 'router', what now? They only contain libraries.
46
47 Should I better remove the symbolic links and add scripts there which adds -m32 -march=i686 to the parameter list (I could do it because those compiler names are only used on 'laptop').
48
49 Roland
50
51 >
52 > > I left the default CHOST as is and on the Debian systems I provided the required compiler.
53 >
54 > "provided the required compiler" should mean that on every server you
55 > have a complete 32-bit toolchain (binutils, gcc, glibc and kernel
56 > headers) with the version of each component matching those on your
57 > distcc client. You should be able to compile a 32-bit executable locally
58 > on any of the Debian systems just by invoking 'i486-pc-linux-gnu-gcc'.
59 >
60 > Setting up such a toolchain can be quite a PITA, so on Gentoo it's
61 > usually done with crossdev -- but as long as you get things right that's
62 > not a requirement.
63 >
64 > > 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).
65 > > 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.
66 > > export HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
67 > > I think this line only needs to be extended with $(CFLAGS) then the fix is complete.
68 >
69 > No. CFLAGS are for the build target, HOSTCFLAGS are for the build host.
70 > Building (configuring, actually) klibc involves compiling a tool which
71 > is run on the host (i.e. the machine you're building on), before
72 > compiling klibc itself for the build target.
73 So CFLAGS and HOSTCFLAGS must be set to the same in make.conf? It is really confusing. :(
74
75 > In your case both the host and the target are the same
76 > (i486-pc-linux-gnu), so the difference might not be very clear, but if
77 > you were compiling klibc for a different arch (e.g. powerpc) you would
78 > have a completely different build target, with its set of CFLAGS.
79 I used the lines from default gentoo installation and only added "-fPIC -m32".
80
81
82 > and let us know if it fixes your problem.
83 Okay.
84
85 Roland

Replies

Subject Author
[gentoo-user] Re: Some essential packages fail to compile Andrea Conti <alyf@××××.net>