Created
March 26, 2025 13:14
-
-
Save imweijh/13025f6c020878e455be1e7ebc1583fb to your computer and use it in GitHub Desktop.
Your new compiler will be at ~/gcc10/bin/gcc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install -y curl build-essential libgmp-dev libmpfr-dev libmpc-dev | |
mkdir /tmp/$$ && cd /tmp/$$ | |
curl -s https://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.xz | tar xJ | |
mkdir build && cd build | |
../gcc-10.3.0/configure --prefix=$HOME/gcc10 \ | |
--disable-dependency-tracking \ | |
--disable-nls \ | |
--disable-multilib \ | |
--enable-default-pie \ | |
--enable-languages=c,c++ | |
make -j$(nproc) | |
make install |
https://gcc.gnu.org/wiki/FAQ#configure
GCC tends to have problems when configured in the same directory as the GCC source code, or in any subdirectory therein
So put your objdir up a level:
$ git clone ... gcc
$ mkdir objdir
$ cd objdir
$ ../gcc/configure ...
If you're just building a native compiler, you don't need --host. It will figure that out on its own. Just pick an install prefix, --prefix=, which is where your compiler will go when you make install. You don't need it installed in the system. Just put it somewhere your user has write permissions, then add that to your PATH.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.reddit.com/r/debian/comments/mmure2/upgrading_the_gcc_gnu_compiler_in_buster/