Upgrade to gcc 4.9
Ubuntu 14.04
Ubuntu 14.04 comes with gcc 4.8.4. For Audacity we need gcc 4.9.x. gcc 4.9.3 is confirmed to work fine. The two links below are the sources of the steps to follow information on this page:
Steps
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.9 sudo apt-get install g++-4.9
The default repository that Ubuntu 14.04 gets its code from does NOT include gcc 4.9. These steps get us the newer compiler. However it will NOT (yet) be used by default.
We are going to make it so that we can easily switch back and forth between 4.8 and 4.9.
sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++
The above is in case we had something set previously to switch between, and this clears it out.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --set c++ /usr/bin/g++
These above are setting up symbolic links. The numbers 10, 20 and 30 give the priority of those choices, with higher numbers preferred. The ones that are vital are the 'g++' ones, since we use c++ for Audacity. After the steps above Ubuntu will already be set up to use gcc 4.9 by default. We can check that with these two lines:
gcc -v g++ -v
If we ever need to switch between 4.9 and 4.8 we can, using:
sudo update-alternatives --config gcc sudo update-alternatives --config g++
After having made the switch of compiler, when compiling Audacity we must first let the build process know we have a different compiler, with different capabilities, by using:
./configure --without-libflac --without-lv2 --without-ffmpeg CXXFLAGS="-std=gnu++11"
before we make. [I have never yet compiled with flac or lv2 on Ubuntu]. Then make:
make
in the audacity build directory.