Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: intel processors x gentoo
Date: Tue, 28 Sep 2010 21:26:53
Message-Id: pan.2010.09.28.20.18.02@cox.net
In Reply to: [gentoo-amd64] Re: intel processors x gentoo by Nikos Chantziaras
1 Nikos Chantziaras posted on Tue, 28 Sep 2010 21:30:34 +0300 as excerpted:
2
3 > On 09/28/2010 08:03 PM, Zhu Sha Zang wrote:
4 >> I have some machines running gentoo and every machine running under
5 >> AMD Processors (64-bit profile), everything is right. Every source code
6 >> compile fine.
7 >>
8 >> But, some machines, i've installed under Intel Core 2 Quad or i7
9 >> processor and this machines have problem compile especific 2 packages:
10 >>
11 >> glibc (>=2.11.2) and lvm2 (2.02.73-r1)
12 >>
13 >> It's weird, don't compile in any intel processor machine.
14 >>
15 >> Take a example of emerge --info uner i7 machine.
16 >>
17 >> CFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"
18 >
19 > Maybe use some sane CFLAGS, like removing -msse4 -mcx16 -mpopcnt -msahf
20 > might help.
21
22 Agreed, but more precisely, if you know your CPU does have those
23 instructions, try something simple (like just "-march=core2 -O2 -pipe")
24 when you have problems, but you can leave them there for normal compiles.
25
26 In particular, glibc can be sensitive to over-optimization, and since it's
27 so core a package -- your whole system will break if it breaks,
28 traditionally, the glibc ebuilds back off on optimizations, removing many
29 of them. You can trace this thru the glibc ebuild, into the common eblit,
30 and from there into flag-o-matic.eclass. In particular in flag-o-matic,
31 see the strip-flags and setup-allowed-flags functions.
32
33 Also note, and this just might be where you're running into problems, that
34 on multi-lib profiles such as normal amd64 (with both 32-bit and 64-bit
35 libs, unless you're running a no-multilib profile as I've been doing here
36 for some time), glibc is one of a handful of packages that compiles
37 multiple times, for BOTH 64-bit and 32-bit. So for glibc, gcc, sandbox,
38 and possibly binutils, you'll want to be *SURE* that all your flags will
39 work in 32-bit mode as well as 64-bit mode. If some of those -m flags
40 only apply to 64-bit mode...
41
42 Finally, let me mention -march=native. If you're actually compiling on
43 your target machine (and not using distcc or the like on other machines
44 with different allowed instructions), -march=native will include all safe
45 -m options for your machine, without you having to enumerate them
46 specifically. IIRC, -march=native was added with gcc-4.4, so it's
47 relatively new and isn't as widely documented as the other -march options.
48
49 Meanwhile, in the context of -march, both =native and traditionally
50 specified, it's also worth noting for future reference that gcc-4.5 (which
51 isn't stable yet, and is either still hard-masked or just recently ~arch,
52 but I'm running it without issue, thanks to flameeyes' tinderbox testing
53 and early bug-filing) enables some new features on some CPUs. It's thus
54 quite possible with some of the newer instruction sets that -march=native
55 and the specific -march=targets will cause a bit of an issue in the gcc-4.5
56 upgrade. (I noticed it here, because I build for my atom based netbook in
57 a dedicated 32-bit chroot on my older 3-digit Opteron based main machine.
58 When I switched it to gcc-4.5, the -march= I was using activated some new
59 instructions not available on my older build machine, and packages,
60 including bzip2 and sed, pretty critical for normal emerges, broke. I had
61 to copy gcc-4.4 compiled binaries off of my netbook back to the build-
62 image to get back in business, then experiment a bit with various settings
63 until I found a cflags set that worked on both the build-system and the
64 atom. All this because gcc-4.4 ignored those instructions even tho the -
65 march I had set allowed them, while gcc-4.5 made use of them, thus
66 triggering the breakage, until I turned off the instructions it was trying
67 to use, now. Of course, if I was building on the netbook itself, that
68 shouldn't have been a problem.)
69
70 --
71 Duncan - List replies preferred. No HTML msgs.
72 "Every nonfree program has a lord, a master --
73 and if you use the program, he is your master." Richard Stallman