简体   繁体   中英

How to cleanly install gcc-4.9 and g++-4.9 to Ubuntu 18.04 Bionic Beaver?

I couldn't find them even after adding ppa:ubuntu-toolchain-r/test repository to apt. I'd like to use package manager.

I ended up with a rather undirty hack (way less dirty, than of what you see in ubuntu land):

  1. Temporarily, change sources.list from bionic to xential
  2. apt update
  3. aptitude install gcc-4.9 g++-4.9
  4. change sources.list back to bionic, apt update
 sudo -i apt update; aptitude full-upgrade cd /etc/apt sed 's/bionic/xential/g' < sources.list > sources.list-xential mv -v sources.list{,-bionic} ln -sv sources.list-xential sources.list apt update aptitude -y install gcc-4.9 g++-4.9 ln -svf sources.list-bionic sources.list apt update

This way you can use package manager and the official packages. I didn't break anything, as apt doesn't downgrade without need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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