GCC4.7.0 Linux installation headache

Summary:
Operating system: (Linux) Ubuntu 12.04
Downloaded the “gcc-4.7.0.tar.gz” and “gcc-4.6.3-4.7.0.diff.gz” files
Unzipped the folders using the command terminal

Problem
For the past 5days I’ve been trying to install this compiler using the terminal since the latest version of gcc isn’t available in the software centre (4.6.3 is there instead). And I don’t want gcc 4.6.3 since it has inferior C++ 11 support which I really need for my dissertation project the next academic year. So far I’m stuck on stage 3 of the stages listed below according to the documentation.

1. Prerequisites
2. Downloading the source
3. Configuration
4. Building
5. Testing (the optional phase)
6. Final Install

When triying to configure the files I've tried these commands (and they failed)

mkdir var/gcc
cd var/gcc
usr@tubuntu:~/Downlaods/gcc-4.7.0$ configure [--with-pkgversion=version] [--target=target]
//error received
“configure: command not found ”

I thought this was how configuration was done since the stallation document index.html stated so. So afterwards I decided to try other methods like:

sudo ./configure
and
sudo make ./configure

and I get these errors
“./configure: command not found ”

It just feels like it doesn't want to be configured at all, all my efforts have been in vain and its day 5 now with no progress, very irritating :((. Plus I've rudementary commands like

make

make install

configure

make configure

sudo apt-get install
for sudo apt-get install I get the following output and nothing else :(

“Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 170 not upgraded. ”

What do I do were can I find a decent tutorial since even the installation files are giving me a headache and I'm feeling quite discouraged at the moment.


You don't need to compile it yourself. Just add the following line to the software sources in Synaptic:

Then reload the package information and install the package g++-4.7.

Alternatively, all of this can be done on the command line:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7
what is "Synaptic"?
what is "Synaptic"?
it is an artifact from long long time ago :D
about a year.

use this only
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7
Last edited on
Synaptic is a graphical application for dealing with all the package management. It's available in the Ubuntu Software Center.

@Shinigami
And what if someone wants more options or more control over what exactly they install on their system but isn't too skilled with the console?

-Albatross
Last edited on
I think console is easier than Synaptic as all you need is to find command in internet and copy - past to terminal. For example this 3 commands above. In Synaptic you get a gui which only makes it more complicated.

P.S. and for most users will be enough Ubuntu software center. Only for more advanced tasks you will need Synaptic or terminal.
Last edited on
@Blessman11: if you want to execute a program that ii is in the current directory it is not in the $PATH, you need to qualify its name
$ ./configure


You shouldn't need to be root in order to configure or make, and if you choose a local prefix you could also install without being superuser.

¿Did you ever bother to check that the file was there? ¿did you look for its permissions?
$ ls -l configure
$ chmod u+x configure #gives you (the owner) execution permission
i


usr@tubuntu:~/Downlaods/gcc-4.7.0$ configure [--with-pkgversion=version] [--target=target]
¿did you actually wrote that? (the brackets I mean)
Last edited on
@ne555

yeah I tried the line and it gave me nothing (exactly as written below)
usr@tubuntu:~/Downlaods/gcc-4.7.0$ configure [--with-pkgversion=version] [--target=target]
Last edited on
@Arthar
thanks it worked, but now for a stupid question, how do I access the compiler since according to some other forum I read, there might be a conflict between gcc4.6 and this 4.7 I've just installed
It should be the default compiler now. If not, it's g++-4.7.
Run
1
2
g++ -v
g++-4.7 -v

to check.

yeah I tried the line and it gave me nothing (exactly as written below)

Things in brackets indicate optional switches, you aren't supposed to actually write them verbatim.
@Athar

When the command below, I still get the 4.6.3 version despite running the code you listed. Howver I notice that your
g++-4.7 -v
command works since it recognises that the compiler is installed.

gcc --version


gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 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.

bump _any_help?
Use which gcc to determine which gcc is actually being used. Follow it, and eventually it'll be a link to the older version. Change the link.
@Moschops

Apparently my g++-4.7 compiler in this path
/usr/bin/gcc
along with my previous gcc compilers. How can I change my c++ compiler to to g++-4.7?
There is probably somewhere a link named g++ that points at one of those compilers. Delete it and make a new one that points to the compiler version you want.

The syntax for deleting is rm fileToDelete

The syntax for linking is ln -s fileToLinkTo nameOfLink
Last edited on
Topic archived. No new replies allowed.