简体   繁体   English

如何在Linux上安装GCC 5.1(Ubuntu)

[英]How to install GCC 5.1 on Linux (Ubuntu)

I'd like to experiment with the new GCC 5.1 C++ compiler on Ubuntu. 我想在Ubuntu上试验新的GCC 5.1 C ++编译器。

How can I install GCC 5.1 on Ubuntu? 如何在Ubuntu上安装GCC 5.1?

I'd prefer some form of pre-built executable that I could just download and install, instead of downloading GCC's sources and building the whole GCC 5.1 from them. 我更喜欢某种形式的预构建可执行文件,我可以下载和安装,而不是下载GCC的源代码并从中构建整个GCC 5.1。

Moreover, since I read libstdc++'s ABI changed in GCC 5, must a new version of libstdc++ be installed with GCC 5.1, too? 此外,由于我在GCC 5中读到了libstdc ++的ABI更改,因此必须在GCC 5.1中安装新版本的libstdc ++吗?

Package g++-5 (gcc version 5.2.1) is available in debian testing or in ubuntu wily. 包g ++ - 5(gcc版本5.2.1)可用于debian测试或ubuntu wily。 Previous milestones are 4.9 and 4.8. 之前的里程碑是4.9和4.8。 It would be more difficult to get a version in between, like 5.1. 获得介于两者之间的版本会比较困难,比如5.1。

If still satisfied with 5.2.1 then add this line to /etc/apt/sources.list: 如果对5.2.1仍然满意,那么将此行添加到/etc/apt/sources.list:

deb http://ftp.debian.org/debian/ stretch main

Try to install package and its dependencies: 尝试安装包及其依赖项:

# apt-get update
# apt-get install g++-5

Then hope it is going to be installed without problems. 然后希望它安装没有问题。 (It strongly depends which ubuntu version is used on host.) A g++-4.9 install from stable debian (jessie) to ubuntu trusty (gcc 4.8) has been successful for me. (这很大程度上取决于在主机上使用哪个ubuntu版本。)从稳定的debian(jessie)到ubuntu trusty(gcc 4.8)的g ++ - 4.9安装对我来说是成功的。 When done comment out previously added line from sources list and 完成后,从源列表中注释掉之前添加的行和

# apt-get update

If you are fond of eternal upgrades then set an apt pinning rule instead. 如果您喜欢永恒的升级,那么请设置一个合适的固定规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM