Installing a gcc4.4 snapshot on Ubuntu
The upcoming gcc4.4 release adds a few more C++0x features (initializer lists, auto typed variables, defaulted and deleted functions, strongly typed enums, …) to the in this regard still very incomplete g++. To be able to play with it one has to compile a gcc-snapshot which turned out to be fairly easy.
- Download a copy of the gcc-core and the gcc-g++ snapshot from here. I used gcc-core-4.4-20090306.tar.bz2 and gcc-g++-4.4-20090306.tar.bz2
- Extract both archives into the same directory.
tar xvjf gcc-core-4.4-20090306.tar.bz2 && tar xvjf gcc-g++-4.4-20090306.tar.bz2 && cd gcc-4.4-20090306 - run
configure ./configure --prefix=$SOMEPLACEBe sure not to overwrite your default gcc-installation. If anything is missing configure will complain. - On my Ubuntu system i had to install libmpfr-dev to proceed.
sudo apt-get install libmpfr-dev - Now all it takes is time…
make && make install
To use it just put $SOMEPLACE in front of your $PATH. If you are using it to compile code which uses C++0x features (which is the whole point) you have to add -std=c++0x to your compiler command line. Bonus: If you are using Eclipse/CDT you can start it with the modified path and the builder will pickup the new gcc just fine.