Install gcc-14 on Ubuntu 22.04

Install gcc-14 on Ubuntu 22.04

 The steps:

1 sudo apt install build-essential
2 sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y
3 wget http://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz
4 tar -xf gcc-14.1.0.tar.gz
5 cd gcc-14.1.0
6 ./configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-14.1.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-14.1.0
7 make
8 sudo make install

And if you would like to make it the default:

1 sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-14.1.0/bin/g++14.1.0 14
2 sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-14.1.0/bin/gcc014.1.0 14

Then check out the gcc and g++ version:

 

posted @ 2024-07-05 09:29  钟齐峰  阅读(2227)  评论(5编辑  收藏  举报