A set of gcc compilers is developing very rapidly and there often appear some new features (for example, from the new C ++ standard) that you want to try today, and you don’t want to wait for the release. There is only one way out - to compile the compiler from source. Here I will share my experience in this.
1. To begin with, let's merge the sources from SVN:
svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc
We wait. My connection had to wait about 30 minutes.
2. Now we do this:
cd gcc
./configure --enable-languages=c,c++,java
I will explain the last line a little: here we specify a comma separated list of the compilers we need. I indicated the ones I need (by the way, a branch with go support appeared in gcc, a guide for building it
here )
On my Fedora 12, this script gave expletives like:
')
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
No problem! Put the necessary packages:
yum install gmp mpfr mpc gmp-devel mpfr-devel libmpc libmpc-devel
Now the configuration script should run fine.
3. We try to do make, but we get something like this:
gcc: gengtype-lex.c: No such file or directory
gcc: no input files
We treat as follows:
yum install flex
If it still doesn’t build, you can try make distclean, and then re-run the configure script.
4. We leave to gather for a few hours, and then type:
make install
and use fresh gcc!