Sunday, 21 April 2013

Compiling GCC 4.8.0 on Linux

Ever wondered how to compile gcc? I recently required a feature in a version of gcc that wasn't readily available as a package on my distribution, so as I love source compiling in Linux, the recipe is below:

tar xvzf gcc-4.8.0.tar.gz
cd gcc-4.8.0
./configure --prefix=/opt/gcc480
make install

You can limit the languages by gcc by adding the --enable-languages flag to the configure command eg. --enable-languages=c,c++

Additionally it's quite a beast to compile, so if you have a more than one processor available you may want to add flags to your make to speed up the process.

No comments:

Post a Comment