Is GCC-4.8 available for 12.04 Precise now?
Update: As of 6/05/2013, there is currently a release of gcc 4.8.1 for 12.04(precise) available at https://launchpad.net/~ubuntu-toolchain-r/+archive/test.
The short answer is: gcc-4.8
is currently available for 12.04(Precise) via the toolchain PPA or by compiling the source(see below for details).
Release Announcement
The announcement for the release of gcc-4.8 was made on March 22nd, so you probably won't be seeing this in an official repository just yet.
However, it appears that Launchpad does have a PPA available for the toolchain test builds that does include gcc-4.8, here: https://launchpad.net/~ubuntu-toolchain-r/+archive/test
According to the changelog and package list, there are debs for i386, amd64, arm, and powerpc and were built against raring 13.04.
The latest available version of gcc, for 12.04, is 4.8.1 and is available in the toolchain PPA.
Adding the toolchain/test PPA:
To add the PPA to your system, open a terminal(Ctrl+Alt+t) and run the following commands:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
You will also be prompted to install a number of suggested packages.
These packages are recommended, but optional, for the installation of gcc-4.8.
What C++ features are available in gcc-4.8 that are not available in gcc-4.7.2?
- According to GNU.ORG, gcc-4.7, supports a number of C++11 features.
As of the gcc-4.8 release, gcc-4.7 does not support 8 out of 64 features (See C++0x/C++11 Support in GCC)
These features are:
Language Features
- Rvalue references for *this
- Generalized attributes
- Alignment support
- Inheriting constructors
Concurreny
- Bidirectional Fences
- Memory model
- Abandoning a process and at_quick_exit
- Thread-local storage
- For a full list of changes in gcc-4.8, see the Changelist
I need these gcc features on 12.04 Precise, now. How can I get them?
Building GCC-4.8 from source:
If you need gcc-4.8 on 12.04 now, your only option is to build it from source.
Please read the GCC installation FAQ prior to installation.
You can download gcc-4.8 from one of gnu.org's mirror sites or directly from their SVN server.
Here is an example of steps to compile from source (see here for additional details.) Note that these may vary depending on your system and preferences.
Download the source code
- Make a build directory (
mkdir gcc-build && cd gcc-build
)
- Download the source file:
wget http://www.netgull.com/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2
(adjust this command to use an appropriate mirror site.
- Unzip the file (
tar -xvjf <file name>
)
Install some additional libraries (sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev libc6-dev
)
- Compile the source:
./gcc-4.8.0/configure --prefix=/app/gcc/4.8.0
- Run
make
(This will take some time to complete. Go make some coffee, or bake some cookies. ;-))
- Install the code:
sudo make install
Once this process has completed, run the command gcc --version
to verify that the installation has completed successfully. You should see something similar to the following output:
maggotbrain@foucault:~$ gcc --version
gcc (Linaro 4.8.0) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The bottom line: Thank all those folks who provide easy to install Ubuntu backports for you. Give them some of the cookies that you baked while running make
. ;-)
It's likely you need to install the libc6-dev
package. The errors you see indicate the linker (ld
) is unable to link against the C library (and the object files it mentions, crt1.o
for example, are part of this package).
I suggest you do sudo apt-get install build-essential
, it will install, well, the essential tools and packages for basic builds to work. build-essential
is a meta-package, which doesn't install any files of its own but depends on the required packages, so it's a safe bet to install it.
Best Answer
Indeed, there is no "uninstall" command when installing from source, unless the developer has decided to put one in. (i.e., it's not impossible for a developer to create a script that undoes everything)
Your only option is to go into
/usr/local/bin/
and remove each file yourself. But which ones to remove?One solution is to reinstall 5.4, but specify a new directory that isn't
/usr/local/bin/
. This will give you a list of files that 5.4 installed. Then, using the list of files, go into/usr/local/bin/
and remove them manually. Note that it probably installed libraries and documentation into other directories, so to remove it completely, you will have to do more than just/usr/local/bin/
.An alternative is to not do an uninstallation and just install gcc 4-8 on top of 5.4. It's the same program, but just a different version. So
gcc
version 4.8 will overwrite 5.4. The "downside" is that you might have 5.4 files lying around, but they will just occupy (relatively little) space. It'll solve your problem and you can move ahead with what you want to do.Of the two options, I'd pick the second one. The 5.4 files that remain won't affect your system. Relative to images, video, or almost any type of data, the space they occupy is fairly little (i.e., compiler, libraries, documentation is probably small). In the future, you should install it in another directory and add symbolic links manually.
update-alternatives
would do that for you if it's a package installed compiler; but for a compiler installed from source, that isn't an option.(Aside: Ubuntu 14.04 has reached end of life, I think. You might consider upgrading some day... If so, then what
/usr/local/bin/
looks like won't matter anymore!)