Compiling GCC from source I'm unsure on how and what to set for optimizing the build.
I want to build two versions. One optimized and one with ggdb
support (not sure if I need the second one). I'm currently concentrating about the first. On previous builds I have usually mainly gone with the defaults.
Find it a bit hard to search the World Wide Web for this, as well as GCC build in general, as 99.9% of the hits is about optimizing code compiled with gcc
and not about the optimization and build of gcc
itself.
Reading the gcc-4.8.1/INSTALL/index.html
docs it is little on this topic.
gcc-4.8.1/INSTALL/build.html
say one can use --with-build-config=NAME...
, but this option is not present in gcc-4.8.1/INSTALL/configure.html
. Is it meant to be used elsewhere?
./configure --with-build-config=bootstrap-O3 ...
Should one use:
make BOOT_CFLAGS='-O3'
instead?
Is it normal to use e.g.:
CFLAGS="-O3" && CXXFLAGS="-O3" && ./configure
or should one stay with BOOT_CFLAGS
?
I have also crossed path with pages like this one, where they state -O3
generates bloated binaries and Using -O3 is not recommended for gcc 4.x..
If this looks messy, you are completely right. I'm rather in a confused/messed/no oversight state here.
In short question are:
- How to compile a optimized version of GCC.
- Is
O3
a good choice?