Skip to content

Instantly share code, notes, and snippets.

@s3rvac
Created October 31, 2020 10:39
Show Gist options
  • Save s3rvac/76ac07f21d5635209accc11fa56bd3fb to your computer and use it in GitHub Desktop.
Save s3rvac/76ac07f21d5635209accc11fa56bd3fb to your computer and use it in GitHub Desktop.
Steps to build GCC 10 on Debian Buster.
#!/bin/bash
#
# Steps to build GCC 10 on Debian Buster.
#
set -e -x
# Install all dependencies.
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y wget xz-utils bzip2 make autoconf gcc-multilib g++-multilib
# Download GCC sources.
wget https://ftp.wrz.de/pub/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.xz
tar xf gcc-10.2.0.tar.xz
cd gcc-10.2.0
wget https://gmplib.org/download/gmp/gmp-6.2.0.tar.xz
tar xf gmp-6.2.0.tar.xz
mv gmp-6.2.0 gmp
wget https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.gz
tar xf mpfr-4.1.0.tar.gz
mv mpfr-4.1.0 mpfr
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
tar xf mpc-1.2.1.tar.gz
mv mpc-1.2.1 mpc
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2
tar xf isl-0.18.tar.bz2
mv isl-0.18 isl
# Build and install it.
./configure --prefix=/opt/gcc-10 --enable-languages=c,c++
make -j$(nproc)
make install
# Create an archive of the installed version.
cd /opt
tar cvJf gcc-10.2.0-debian-buster.tar.xz gcc-10
# Usage example:
#
# CC=/opt/gcc-10/bin/gcc CXX=/opt/gcc-10/bin/g++ LDFLAGS="-Wl,-rpath,/opt/gcc-10/lib64" cmake [..]
#
@MVoloshin
Copy link

change ftp to https or it might not work now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment