Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I try to install Gentoo on a PC with Intel Core i7 870 @ 2.93GHz (4 cores). In Gentoo Linux Documentation, it mentions that one has to configure the compile options, and there is a example

CFLAGS="-O2 -march=i686 -pipe"
CXXFLAGS="${CFLAGS}"

But I don't know which flag value should be used for my PC?

Here is a screenshot when I typed cat /proc/cpuinfo.

enter image description here

share|improve this question
You read the Gentoo documentation and the list of available CFLAGS you can find therein. – Michael Hampton Oct 7 '12 at 21:41
Gentoo Dreams are worse than Chantix Dreams... – kobaltz Oct 7 '12 at 21:44
@Kobaltz, what it means? – user62046 Oct 7 '12 at 21:49

closed as too localized by random Oct 8 '12 at 4:08

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

The flags used in the example you posted:

  • -O2: Level 2 optimization. GCC optimization levels go from 0 (almost no optimizations) to 3 (use possibly unsafe optimizations). Level two is a nice compromise between performance and safety;
  • -march=i686: This tells GCC to compile and optimize for the old Pentium Pro, and will fail on your machine unless your installation is 32-bits. Here is a list of recognized -march arguments, but which, in your case, should be corei7. IMHO, using native (-march=native), added in GCC 4.7 (or 4.6), is the best thing to do, as it asks GCC to autodetect your CPU and use the appropriate value;
  • -pipe: Mostly unnecessary. See this question on SO.

Thus CFLAGS should be -O2 -march=native. Unless you have a specific reason to use different flags when compiling C++ code, having CXXFLAGS="${CFLAGS}" is ok.

You may also want to try adding -flto to BOTH CFLAGS and LDFLAGS. This tells the compiler and linker to also do some optimizations on link time, which may increase performance at the cost of compilation time and memory usage.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.