From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A1CBE138CC0 for ; Thu, 19 Mar 2015 05:13:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B6487E08D4; Thu, 19 Mar 2015 05:13:02 +0000 (UTC) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.225]) by pigeon.gentoo.org (Postfix) with ESMTP id 9C999E08B5 for ; Thu, 19 Mar 2015 05:13:01 +0000 (UTC) Received: from [142.196.200.180] ([142.196.200.180:50267] helo=navi.localnet) by cdptpa-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id D8/A2-09753-DDA5A055; Thu, 19 Mar 2015 05:13:01 +0000 From: Fernando Rodriguez To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? Date: Thu, 19 Mar 2015 01:12:39 -0400 Message-ID: <6701997.ATxEyus6A8@navi> User-Agent: KMail/4.14.3 (Linux/3.19.1; KDE/4.14.3; x86_64; ; ) In-Reply-To: <20150319042026.GA7681@waltdnes.org> References: <20150319015612.GA7416@waltdnes.org> <2685505.RfjHhG2H7t@navi> <20150319042026.GA7681@waltdnes.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 X-Archives-Salt: 440efba5-2953-4214-aeb9-797e004a751d X-Archives-Hash: 73a1acbd44c6a007990100458916a04a On Thursday, March 19, 2015 12:20:26 AM Walter Dnes wrote: > On Wed, Mar 18, 2015 at 10:27:05PM -0400, Fernando Rodriguez wrote > > On Wednesday, March 18, 2015 9:56:12 PM Walter Dnes wrote: > > > My situation... > > > > > > * I've dug up my ancient netbook, and got Gentoo re-installed on it > > > * The cpu is a dual-core Intel(R) Atom(TM) CPU Z520 > > > * It's 32-bit only; YES! > > > * Compiling just the Seamonkey binary (ignoring its dependancies) took > > > 14 hours > > > > > > I obviously want to offload compiling to another machine. As per the > > > subject, will a 64-bit no-multilb install be able to cross compile > > > 32-bit code? > > > > I've done it with distcc by adding the -m32 option to cflags. I used a script > > (named after the compiler on the gentoo box) to call the compiler with the - > > m32 flag and placed on the PATH environment (just for the distccd service) > > before anything else and it worked. I got a 64 bit arch box to compile for a > > 32 bit gentoo (not nearly as fast as compiling locally on the arch box but > > much faster than the gentoo box). It should work similarly with other cross- > > compile scenarios. > > Thanks. I'll probably be back with a bunch of questions. As a matter > of fact, I already have one. The docs say that it does not work if the > "-march=native" cflag is used. It says to use the output of... > > gcc -march=native -E -v - &1 | grep cc1 > > ...omitting "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.3/cc1 -E -quiet -v -" > I presume. So on the 64-bit host, I would go from... > > CFLAGS="-O2 -march=native -mfpmath=sse -fomit-frame-pointer -pipe -fno- unwind-tables -fno-asynchronous-unwind-tables" > > ...to... > > CFLAGS="-O2 -march=core2 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno- popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno- tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rtm -mno-hle - mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr - mno-xsave -mno-xsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=core2 -fstack-protector -mfpmath=sse -fomit- frame-pointer -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables" > > And on the target (netbook), I'd go to... > > CFLAGS="-O2 -march=atom -mno-cx16 -msahf -mmovbe -mno-aes -mno-pclmul -mno- popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno- tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rtm -mno-hle - mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr - mno-xsave -mno-xsaveopt --param l1-cache-size=24 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=atom -fstack-protector -mfpmath=sse -fomit- frame-pointer -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables" > > Is that correct (assuming that's my output)? The CFLAGS on the host won't be used so you don't need to change them. Now on the host create scripts with the exact full name of the compiler on the target and make distccd can find them (either put them on /usr/bin or make sure to add it's path to the PATH environment var for distccd, if you're using openrc I'm not sure if the init scripts allow it so you may have to start it manually or modify the scripts) and have them exec gcc with the -m32 switch. Make sure you have the same version of gcc selected on both boxes. -- Fernando Rodriguez