I'm about to update default GCC (version 4.6.3) shipped by Ubuntu 12.04 to 4.8.2, though the compilation requires a standalone C++ compiler
我将更新Ubuntu 12.04到4.8.2版的默认GCC(版本4.6.3),尽管编译需要一个独立的c++编译器。
admin@ubuntu: /usr/local/gcc_build$ sudo make
ends up with
结束了
configure: error: C++ compiler missing or inoperational
make[2]: *** [configure-stage1-libcpp] Error 1
Therefore I turn to the process of g++
installation with a preference to the latest version, which means that I would like to compile from source directly rather than apt-get
. But seriously, I can't find the source anyway!(O_o). On the other hand, does the source of GCC also come along with that of g++
in the tar file I downloaded, or not? Thanks.
因此,我倾向于使用最新版本的g++安装过程,这意味着我希望直接从源代码编译而不是用apt-get。但说真的,我找不到来源!另一方面,在我下载的tar文件中,GCC的源代码也与g++的源代码一起出现吗?谢谢。
PS: problem remains unsolved with admin@ubuntu: /usr/local/gcc_build$ /home/admin/gcc-4.8.2/configure --enable-languages=c,c++
问题仍然没有得到解决:admin@ubuntu: /usr/local/gcc_build$ /home/admin/gcc-4.8.2/configure—enablelanguage =c,c++。
3 个解决方案
#1
3
You can easily compile the sources.
您可以轻松地编译源代码。
The following commands worked for gcc 4.7. They should be fine for gcc 4.8 as well:
下面的命令适用于gcc 4.7。对于gcc 4.8,它们也应该没问题:
sudo apt-get install libmpfr-dev libgmp3-dev libmpc-dev flex bison
svn checkout svn://gcc.gnu.org/svn/gcc/trunk
cd trunk
./configure --prefix=/opt/gcc-4.8.2/usr/local/gcc-4.8.2 --enable-languages=c,c++
make
make install
The compiler will be placed in the /opt/ directory, so you have to use it from there.
编译器将被放置在/opt/目录中,所以您必须从那里使用它。
#2
11
-
Add the ppa by
添加的ppa
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:ubuntu-toolchain-r /测试
-
Install g++ and gcc (version 4.8)
安装g++和gcc(版本4.8)
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
sudo apt-get更新;sudo apt-get安装gcc-4.8 g+ -4.8。
-
Run the following commands one by one,
一个接一个地运行下列命令,
sudo update-alternatives --remove-all gcc
sudo update-alternatives——删除所有gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives——删除所有g + +
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo更新-替代品-安装/usr/bin/gcc /usr/bin/gcc-4.8 20。
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo更新替代方案——安装/usr/bin/g++ g++ /usr/bin/g+ -4.8 20。
sudo update-alternatives --config gcc
sudo update-alternatives——配置gcc
sudo update-alternatives --config g++
sudo update-alternatives——配置g++
That's it you are done!
就是这样!
#3
1
Do you want to compile it yourself ? If not, there is a PPA, described here
您想自己编译它吗?如果没有,这里有一个PPA。
#1
3
You can easily compile the sources.
您可以轻松地编译源代码。
The following commands worked for gcc 4.7. They should be fine for gcc 4.8 as well:
下面的命令适用于gcc 4.7。对于gcc 4.8,它们也应该没问题:
sudo apt-get install libmpfr-dev libgmp3-dev libmpc-dev flex bison
svn checkout svn://gcc.gnu.org/svn/gcc/trunk
cd trunk
./configure --prefix=/opt/gcc-4.8.2/usr/local/gcc-4.8.2 --enable-languages=c,c++
make
make install
The compiler will be placed in the /opt/ directory, so you have to use it from there.
编译器将被放置在/opt/目录中,所以您必须从那里使用它。
#2
11
-
Add the ppa by
添加的ppa
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:ubuntu-toolchain-r /测试
-
Install g++ and gcc (version 4.8)
安装g++和gcc(版本4.8)
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
sudo apt-get更新;sudo apt-get安装gcc-4.8 g+ -4.8。
-
Run the following commands one by one,
一个接一个地运行下列命令,
sudo update-alternatives --remove-all gcc
sudo update-alternatives——删除所有gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives——删除所有g + +
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo更新-替代品-安装/usr/bin/gcc /usr/bin/gcc-4.8 20。
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo更新替代方案——安装/usr/bin/g++ g++ /usr/bin/g+ -4.8 20。
sudo update-alternatives --config gcc
sudo update-alternatives——配置gcc
sudo update-alternatives --config g++
sudo update-alternatives——配置g++
That's it you are done!
就是这样!
#3
1
Do you want to compile it yourself ? If not, there is a PPA, described here
您想自己编译它吗?如果没有,这里有一个PPA。