Gentoo Archives: gentoo-user

From: Walter Dnes <waltdnes@××××××××.org>
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 14:31:39
Message-Id: 20150324071754.GB8371@waltdnes.org
In Reply to: Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? by Mike Gilbert
1 On Mon, Mar 23, 2015 at 06:18:46PM -0400, Mike Gilbert wrote
2
3 > You will probably need to add -m32 to CFLAGS to avoid building 64-bit
4 > objects on the 64-bit machine.
5
6 How could i686-pc-linux-gnu-gcc build 64-bit stuff in the first place?
7 I followed the instructions, and ran the following on the host 64-bit
8 machine...
9
10 [d531][root][~] crossdev -t -S i686-pc-linux-gnu
11
12 [d531][root][~] i686-pc-linux-gnu-gcc --version
13 i686-pc-linux-gnu-gcc (Gentoo 4.9.2 p1.2, pie-0.6.2) 4.9.2
14 Copyright (C) 2014 Free Software Foundation, Inc.
15 This is free software; see the source for copying conditions. There is NO
16 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18 [d531][root][~] echo 'int main(){return 0;}' > ctest.c
19 [d531][root][~] i686-pc-linux-gnu-gcc -Wall ctest.c -o ctest
20 [d531][root][~] file ctest
21 ctest: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
22 dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux
23 2.6.32, not stripped
24
25 Here's how far I've gotten with the setup. Let me know if I'm missing
26 anything...
27
28 =========================================================================
29
30 On the host; 64-bit Gentoo on Core2; IP address 192.168.123.251
31
32 # emerge crossdev
33
34 # crossdev -t -S i686-pc-linux-gnu
35
36 # emerge distcc
37
38 edit /etc/conf.d/distccd to indicate allowed client(s). Change the
39 DISTCCD_OPTS line to...
40
41 DISTCCD_OPTS="--port 3632 --log-level notice --log-file /var/log/distccd.log -N 15 --allow 192.168.123.253
42
43 get distccd service running now and every boot up (OpenRC)...
44
45 # rc-update add distccd default
46
47 # rc-service distccd start
48
49 I believe it's OK to leave "-march=native" in the host's make.conf
50
51 =========================================================================
52
53 On the client; underpowered ancient 32-bit Atom netbook; 192.168.123.253
54
55 # emerge distcc
56
57 specify host(s)
58
59 # /usr/bin/distcc-config --set-hosts "192.168.123.251"
60
61 This modifies /etc/distcc/hosts
62
63 In make.conf make the following changes
64
65 MAKEOPTS="-j1 -l2"
66
67 add "distcc distcc-pump" to FEATURES variable
68
69 Replace "-march=native" in CFLAGS with output of...
70 # gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 | perl -pe 's/ -mno-\S+//g; s/^.* - //g;'
71
72 Note that the distcc wiki page gives different instructions here than
73 the crossdev wiki page. The command goes out of its way to remove the
74 "-mno-<whatever>" compiler flags. This results in (one long line)...
75
76 CFLAGS="-O2 -march=atom -msahf -mmovbe -mfxsr --param l1-cache-size=24
77 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=atom
78 -fstack-protector -mfpmath=sse -fomit-frame-pointer -pipe
79 -fno-unwind-tables -fno-asynchronous-unwind-tables"
80
81 Note that I include "-mfpmath=sse -fomit-frame-pointer -pipe
82 -fno-unwind-tables -fno-asynchronous-unwind-tables" myself.
83
84 =========================================================================
85
86 Now for the questions...
87 1) https://wiki.gentoo.org/wiki/Distcc#Using_distcc_with_automake
88 mentions adding...
89
90 export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"
91
92 ...to /etc/env.d/ Is this necessary for Portage/emerge/etc, or is
93 "automake" something separate? (You can tell I'm not a programmer, let
94 alone a developer.)
95
96 2) The docs mention running emerge on the client with the command...
97
98 # pump emerge -u world
99
100 Is that all there is, or am I missing something? Does it
101 "automagically" install properly? Can I assume that...
102
103 a) The "pump" command does the lookup in /etc/distcc/hosts for the
104 appropriate server
105
106 b) The line...
107
108 CHOST="i686-pc-linux-gnu"
109
110 ...in the client's make.conf is sufficient to tell emerge to use
111 "/usr/bin/i686-pc-linux-gnu-gcc" on the host and not "/usr/bin/gcc"?
112
113 3) Is this supposed to happen on the host...
114
115 =====================================================
116 [d531][waltdnes][~] gcc-config -l
117 [1] i686-pc-linux-gnu-4.9.2 *
118
119 [2] x86_64-pc-linux-gnu-4.8.3 *
120 =====================================================
121
122 Note that the asterisk after "x86_64-pc-linux-gnu-4.8.3" is green.
123
124 4) Is the command...
125
126 # DISTCC_DIR="" distccmon-text 5
127 Or:
128 # DISTCC_DIR="" distccmon-gnome
129
130 ...supposed to be run from a seprate terminal?
131
132 --
133 Walter Dnes <waltdnes@××××××××.org>
134 I don't run "desktop environments"; I run useful applications

Replies

Subject Author
Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? Mike Gilbert <floppym@g.o>
Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? Fernando Rodriguez <frodriguez.developer@×××××××.com>