Gentoo Archives: gentoo-user

From: Fernando Rodriguez <frodriguez.developer@×××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code?
Date: Tue, 24 Mar 2015 19:01:55
Message-Id: 2298234.x3bRHs3aKg@navi
In Reply to: Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? by Walter Dnes
1 On Tuesday, March 24, 2015 3:17:55 AM Walter Dnes wrote:
2 > On Mon, Mar 23, 2015 at 06:18:46PM -0400, Mike Gilbert wrote
3 >
4 > > You will probably need to add -m32 to CFLAGS to avoid building 64-bit
5 > > objects on the 64-bit machine.
6 >
7 > How could i686-pc-linux-gnu-gcc build 64-bit stuff in the first place?
8 > I followed the instructions, and ran the following on the host 64-bit
9 > machine...
10 >
11 > [d531][root][~] crossdev -t -S i686-pc-linux-gnu
12 >
13 > [d531][root][~] i686-pc-linux-gnu-gcc --version
14 > i686-pc-linux-gnu-gcc (Gentoo 4.9.2 p1.2, pie-0.6.2) 4.9.2
15 > Copyright (C) 2014 Free Software Foundation, Inc.
16 > This is free software; see the source for copying conditions. There is NO
17 > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 >
19 > [d531][root][~] echo 'int main(){return 0;}' > ctest.c
20 > [d531][root][~] i686-pc-linux-gnu-gcc -Wall ctest.c -o ctest
21 > [d531][root][~] file ctest
22 > ctest: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
23 > dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux
24 > 2.6.32, not stripped
25 >
26 > Here's how far I've gotten with the setup. Let me know if I'm missing
27 > anything...
28 >
29 > =========================================================================
30 >
31 > On the host; 64-bit Gentoo on Core2; IP address 192.168.123.251
32 >
33 > # emerge crossdev
34 >
35 > # crossdev -t -S i686-pc-linux-gnu
36 >
37 > # emerge distcc
38 >
39 > edit /etc/conf.d/distccd to indicate allowed client(s). Change the
40 > DISTCCD_OPTS line to...
41 >
42 > DISTCCD_OPTS="--port 3632 --log-level notice --log-file /var/log/distccd.log
43 -N 15 --allow 192.168.123.253
44 >
45 > get distccd service running now and every boot up (OpenRC)...
46 >
47 > # rc-update add distccd default
48 >
49 > # rc-service distccd start
50 >
51 > I believe it's OK to leave "-march=native" in the host's make.conf
52 >
53 > =========================================================================
54 >
55 > On the client; underpowered ancient 32-bit Atom netbook; 192.168.123.253
56 >
57 > # emerge distcc
58 >
59 > specify host(s)
60 >
61 > # /usr/bin/distcc-config --set-hosts "192.168.123.251"
62 >
63 > This modifies /etc/distcc/hosts
64 >
65 > In make.conf make the following changes
66 >
67 > MAKEOPTS="-j1 -l2"
68 >
69 > add "distcc distcc-pump" to FEATURES variable
70 >
71 > Replace "-march=native" in CFLAGS with output of...
72 > # gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 |
73 perl -pe 's/ -mno-\S+//g; s/^.* - //g;'
74 >
75 > Note that the distcc wiki page gives different instructions here than
76 > the crossdev wiki page. The command goes out of its way to remove the
77 > "-mno-<whatever>" compiler flags. This results in (one long line)...
78 >
79 > CFLAGS="-O2 -march=atom -msahf -mmovbe -mfxsr --param l1-cache-size=24
80 > --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=atom
81 > -fstack-protector -mfpmath=sse -fomit-frame-pointer -pipe
82 > -fno-unwind-tables -fno-asynchronous-unwind-tables"
83 >
84 > Note that I include "-mfpmath=sse -fomit-frame-pointer -pipe
85 > -fno-unwind-tables -fno-asynchronous-unwind-tables" myself.
86 >
87 > =========================================================================
88 >
89 > Now for the questions...
90 > 1) https://wiki.gentoo.org/wiki/Distcc#Using_distcc_with_automake
91 > mentions adding...
92 >
93 > export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"
94 >
95 > ...to /etc/env.d/ Is this necessary for Portage/emerge/etc, or is
96 > "automake" something separate? (You can tell I'm not a programmer, let
97 > alone a developer.)
98 >
99 > 2) The docs mention running emerge on the client with the command...
100 >
101 > # pump emerge -u world
102 >
103 > Is that all there is, or am I missing something? Does it
104 > "automagically" install properly? Can I assume that...
105 >
106 > a) The "pump" command does the lookup in /etc/distcc/hosts for the
107 > appropriate server
108 >
109 > b) The line...
110 >
111 > CHOST="i686-pc-linux-gnu"
112 >
113 > ...in the client's make.conf is sufficient to tell emerge to use
114 > "/usr/bin/i686-pc-linux-gnu-gcc" on the host and not "/usr/bin/gcc"?
115 >
116 > 3) Is this supposed to happen on the host...
117 >
118 > =====================================================
119 > [d531][waltdnes][~] gcc-config -l
120 > [1] i686-pc-linux-gnu-4.9.2 *
121 >
122 > [2] x86_64-pc-linux-gnu-4.8.3 *
123 > =====================================================
124 >
125 > Note that the asterisk after "x86_64-pc-linux-gnu-4.8.3" is green.
126 >
127 > 4) Is the command...
128 >
129 > # DISTCC_DIR="" distccmon-text 5
130 > Or:
131 > # DISTCC_DIR="" distccmon-gnome
132 >
133 > ...supposed to be run from a seprate terminal?
134 >
135
136 Let me know if you have any luck with pump mode, I didn't. IIRC it sort of
137 worked but most compiles fell back to compiling locally so it's was actually
138 slower. The rest of this post (or parts) may not apply if you do get it
139 working.
140
141 I've also found that I get better performance without the -l N on MAKEPOTS and
142 specifying the number of cores per host as follows:
143
144 distcc-config --set-hosts "192.168.123.251/4"
145
146 It may not matter if you got only one host. Also change the -j N flag
147 accordingly. You'll need to do some testing to find the right number, I've find
148 that between 4 to 8 cores per physical core works best (for some reason varies
149 between hosts). Just look for the right number, you'll know when you see the
150 CPU usage maxing on the hosts during a parallel build. Keep in mind that most
151 makefiles don't do a lot of parallel compiling so you need to use the monitor
152 utility to check during a busy time.
153
154 Also if you're using wireless and you can connect via ethernet do that because
155 you will see a LOT of traffic.
156
157 --
158 Fernando Rodriguez

Replies

Subject Author
Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? Walter Dnes <waltdnes@××××××××.org>
Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? Walter Dnes <waltdnes@××××××××.org>