How do I install gcc 4.7?

1

I wish to install gcc 4.7 so that I can use some c++11 features.

I downloaded the source, ran ./configure and was told I needed GMP. Downloaded the code for that, hit ./configure and was told I needed m4. But I already have m4 (least that is what synamptic tells me).

What is going on and how can I fix it?

You can try this PPA for installing gcc 4.7. Do note that it has packages only for 12.04 and not for 11.10.

Run the following commands in a terminal:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.7

Or, if you prefer a graphical way of installing a PPA, take a look at What are PPAs and how do I use them?.

NOTE!!

You also most likely need to take care of g++-4.7

So the full commands list will be:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.7 g++-4.7

Also, don't forget to update-alternatives, as suggested here

...
0 0
2
How to install gcc in mandriva 2009 (with NO internet @linux)?

location: linuxquestions.com - date: December 13, 2008
Mandriva linux 2009, One (dont have gcc installed). First of all, i do not have internet in linux, so i can't use install and remove manager to download .rpm files =/ And i won't have it any time soon What i've tried is searching for .rpm files in the net, but everything i found belonged to other versions (like mandriva 2007 or 2008) and failed to install. I also tried to install as explained in here: http://gcc.gnu.org/install/ but it seems to be really complicated, and there was this phrase: "when configuring a native system, either cc or gcc must be in your path or you must set CC in your environment before running configure. Otherwise the configuration scripts may fail. " seems like it needs a compiler in the system for installation, so it doesnt work for me since i dont have a compiler. I guess the easiest way would be getting .rpm file of gcc for mandriva...

0 0
3

You may find it just as easy to have your own Solaris host. Just install Solaris X86 into VirtualBox and then you have your own. If the purpose is development and test as in your case then there's no license cost to use Solaris.

Using a package repository avoids the hassle of building yourself and managing dependencies, wondering if you have 64bit support, etc. The downside is that you need to have superuser privileges to install the packages which is why I suggest that you have your own private (virtual) Solaris host.

Install Solaris 11.2 Beta on it. Doesn't matter for your purpose that it is a beta (I'm using it and haven't been able to break it in any way). The reason why I propose to use that version is that the package repository for that version gives a choice of many different versions of GCC (4.5, 4.7 and 4.8). Do you have a need for specifically v4.7.1 or would v4.7.3 also be ok?

If you don't want to use a beta version of Solaris then you can use...

0 0
4

I installed Lubuntu 11.10 and I installed build-essential with this command:

sudo apt-get install build-essential

Now I have gcc 4.6

I read on some forum that adding the next PPA I'll be able to install gcc 4.7:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

I did that, then ran:

sudo apt-get update sudo apt-get install gcc-4.7

But my machine can't find the gcc-4.7 package? Any suggestion?

Answers

ppa:ubuntu-toolchain-r/test is the wrong PPA unless your aim is to test new, experimental packages that might be vastly unstable. Furthermore, since that PPA is just a sandbox for testing, there's no particular package that's ever necessarily in there. Packages come and go.

At the time of this posting, the only package that PPA provides for Oneiric (11.10) is libatomic-ops.

If you want to install PPA-provided toolchain builds, for any purpose except testing new toolchain-r packages, the "toolchain-r" team provides this...

0 0
5

Currently, MinGW has version 4.7.0. There is also the TDM-GCC distribution, which is a bit more up-stream at version 4.7.1. As far as I know, there are not too many differences between 4.7.0 to 4.7.2, so you'd probably be ok with either ones. This is probably easier to live with that 6-months lag than trying to build GCC from source on Windows.

On Linux, if you have the latest ubuntu distribution 12.10 (or any sister distro), then you will find 4.7.2 in the official repositories. Otherwise, I'm sure you can find a PPA repository that carries it, or hook to upstream repositories. But this kind of depends on your distro. Personally, I keep a rolling build of GCC hooked to the svn repository. Building the complete GCC suite takes a couple of hours on a decent machine, and the process is a breeze in Linux (just checkout the svn repo, and enter a few commands to configure-build-install it, you just have to wait a little while). I update and rebuild about every month or...

0 0
6

I have a project that uses cmake that I'm trying to compile (MapCrafter). I've already done cmake . to make the makefile. I've run brew install gcc47 to get GCC 4.7. It put it in /usr/local/Cellar/gcc47 for some reason.

Whenever I run make, it still uses GCC 4.2.1 at /usr/include/c++/4.2.1/ that cannot compile this code. I can't find any option for switching the compiler that works. make CC=/usr/local/Cellar/gcc47/4.7.3/bin/gcc-4.7 CXX=/usr/local/Cellar/gcc47/4.7.3/bin/c++-4.7 still uses 4.2.1. I almost never compile anything outside of Xcode or apt-get, so I'm really ignorant in this area. What step am I missing?

I do not know why this worked this time and not before, but I used cmake-gui and hit configure. Then I set my C compiler to /usr/local/Cellar/gcc47/4.7.3/bin/gcc-4.7 and my C++ compiler to /usr/local/Cellar/gcc47/4.7.3/bin/c++-4.7 and made the makefile. I've already tried this and don't remember changing anything… Now, make is using the correct...

0 0
7
H

ow do I install GNU/GCC compiler and related tools (such as make, debugger, man pages) collection under Debian Linux system using command line options?


You need to install the following packages on a Debian and Ubuntu Linux:


build-essential

package – Installs the following collection to compile c/c++ program on Debian/Ubuntu Linux:


libc6-dev – C standard library.gcc – C compiler.g++ – C++ compiler.make – GNU make utility to maintain groups of programs.dpkg-dev – Debian package development tools.


Basically, build-essential package contains an informational list of packages which are considered essential for building Debian packages including gcc compiler, make and other required tools. This package also depends on the packages on that list, to make it easy to have the build-essential packages installed.

Installation

Open the Terminal and then type the following apt-get command as root user or use the apt command:
$...

0 0