Upgrade to gcc 4.9
gcc 4.9 is required for Audacity 2.1.3 and later
gcc 4.8 does not always compile the newer code idioms we are using correctly, which led to consistent segfaults when saving projects ( http://bugzilla.audacityteam.org/show_bug.cgi?id=1397 ). So we now require gcc 4.9.x for Audacity 2.1.3 and later.
Ubuntu 14.04 comes with gcc 4.8.4 so we need to upgrade gcc. 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:
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++
- Gale 28Aug16: If you build Audacity against system ffmpeg on Ubuntu 14.04 or later, you usually have to use
- which removes Libraries Preferences. Personally I have never got the resultant Audacity binary to behave properly with FFmpeg this way. I always self-build FFmpeg 2.2.3 then Audacity behaves.
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-ffmpeg CXXFLAGS="-std=gnu++11"
before we make. [I have never yet compiled with ffmpeg on Ubuntu]. Then make:
in the audacity build directory.