将 Ubuntu 12.04 上的 GCC 4.6.3 升级到 4.8.2 [英] Upgrade GCC 4.6.3 on Ubuntu 12.04 to 4.8.2
问题描述
我即将将 Ubuntu 12.04 提供的默认 GCC(版本 4.6.3)更新到 4.8.2,尽管编译需要独立的 C++ 编译器
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
admin@ubuntu: /usr/local/gcc_build$ sudo make
结束
configure: error: C++ compiler missing or inoperational
make[2]: *** [configure-stage1-libcpp] Error 1
因此我转向g++
的安装过程,偏好最新版本,这意味着我想直接从源代码编译而不是apt-get
.但是说真的,我无论如何都找不到源!(O_o).另一方面,在我下载的tar文件中,GCC的源代码是否也与g++
的源代码一起出现?谢谢.
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.
PS:admin@ubuntu 的问题仍未解决:/usr/local/gcc_build$/home/admin/gcc-4.8.2/configure --enable-languages=c,c++
推荐答案
您可以轻松编译源代码.
You can easily compile the sources.
以下命令适用于 gcc 4.7.它们也应该适用于 gcc 4.8:
The following commands worked for gcc 4.7. They should be fine for gcc 4.8 as well:
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
编译器会放在/opt/目录下,所以你必须从那里使用它.
The compiler will be placed in the /opt/ directory, so you have to use it from there.
这篇关于将 Ubuntu 12.04 上的 GCC 4.6.3 升级到 4.8.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!