lle*_*ekn 15
我需要在 debian jessie 上安装 GCC 5+,并且可用于 debian 测试(至少在 jun-16 上),您可以使用 apt-pinning 安装可用的软件包(请参阅https://wiki.debian.org/AptPreferences) .
要使用 apt-pinning 在 debian jessie 上进行测试安装 GCC 5+:
通过在/etc/apt/sources.list.d包含该行的目录中创建一个文件,将 debian testing repo 添加到您的 apt 源
deb http://ftp.us.debian.org/debian testing main contrib non-free 
通过创建/etc/apt/preferences.d包含以下内容的文件,指示 debian 对某些软件包使用测试源:
Package: *
Pin: release a=testing
Pin-Priority: 100
Run Code Online (Sandbox Code Playgroud)更新apt数据库: sudo apt-get update
从测试安装 gcc: sudo apt-get install -t testing gcc
请注意,使用-t testing您告诉 apt-get 从之前配置的测试源安装 gcc。
我强烈建议在再次编译源代码之前清理所有编译并重新编译任何依赖项。
玩得开心!
小智 6
截至 2017-02-19,gcc-5已从测试中移除:
https://tracker.debian.org/pkg/gcc-5
你可以apt-get install gcc-5,如果你先执行该行根:
echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" > /etc/apt/sources.list.d/unstable.list
Run Code Online (Sandbox Code Playgroud)
然后,您可能希望/etc/apt/preferences.d根据 llekn 的回答更改该源的优先级。
小智 6
要将前面的 2 个答案合并为一个有效的答案:
echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
apt-get update
apt-get install -t unstable gcc-5
Run Code Online (Sandbox Code Playgroud)
但!!!当您从不稳定安装软件包时,请自行承担风险。/etc/apt/sources.list.d/unstable.list安装软件包后,您可能还想删除。
如果可能,请在 Docker 下安装,以免弄乱您的操作系统。你的旅费可能会改变。
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           53402 次  |  
        
|   最近记录:  |