January 29, 2025

Installing cpp-13, gcc-13 and g++-13 in Debian 12

Installing cpp-13, gcc-13 and g++-13 in Debian 12

c++ logo

Continuing from my previous post for setting default versions of cpp, gcc & clang, here I describe how to install cpp-13 on Debian 12.

Problem:

Debian 12 only contains up to cpp-12.

Solution:

Download, compile, install and configure cpp-13, gcc-13, g++-13 :

wget https://gcc.gnu.org/pub/gcc/releases/gcc-13.3.0/gcc-13.3.0.tar.gz
tar -xvzf gcc-13.3.0.tar.gz
cd gcc-13.3.0

make distclean
./contrib/download_prerequisites
./configure --disable-multilib --enable-languages=c,c++ --program-suffix=-13
make -j3

sudo make install
sudo update-alternatives --install /usr/bin/cpp cpp /usr/local/bin/cpp-13 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/gcc-13 50

Where 50 is the next level used due to my aforementioned blogpost. We can now check the default version:

$ cpp --version
cpp (GCC) 13.3.0
[...]
 
$ gcc --version
gcc (GCC) 13.3.0
[...]

Defaults can be changed via:

sudo update-alternatives --config cpp
sudo update-alternatives --config gcc

Notes: I found make distclean to be necessary for every compile attempt, as any change of configuration will cause compile error. Furthermore, There may be ./configure parameters to change the install location which i did not use here. As per GNU gcc documentation there is no make uninstall, so be cautioned that removal will need to be manually performed (/usr/local/bin/ --> specific files, not all contents).

Alternative:

Use a PPA as per https://markusthill.github.io/blog/2024/installing-gcc/

Resources:

~~ good luck!

No comments:

Post a Comment

Comments, Suggestions or "Thank you's" Invited! If you have used this info in any way, please comment below and link/link-back to your project (if applicable). Please Share.
I accept Bitcoin tips of ANY amount to: 1GS3XWJCTWU7fnM4vfzerrVAxmnMFnhysL
I accept Litecoin tips of ANY amount to: LTBvVxRdv2Lz9T41UzqNrAVVNw4wz3kKYk