build gcc 9.3 on ubuntu 18.04 x86_64

Table of Contents

build

# prepare source
tar xf gcc-9.3.0.tar.xz
cd gcc-9.3.0/contrib/
./download_prerequisites

# move dependency packages to source root directory
mv isl-0.18 ../isl
mv mpfr-3.1.4 ../mpfr
mv mpc-1.0.3 ../mpc
mv gmp-6.1.0 ../gmp

# do not build in source directory
cd ../..
mkdir build-gcc
cd build-gcc
../gcc-9.3.0/configure -v --with-pkgversion='Ubuntu-18.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,c++ --program-suffix=-9.2 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-gtk-cairo --with-arch-directory=amd64 --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-libstdcxx-pch
make -j12
sudo make install

troubleshooting

asm/errno.h: No such file or directory

check linux-libc-dev

check whether package linux-libc-dev is installed, if not, install it first

check /usr/include/asm

DO NOT link /usr/include/asm-generic to /usr/include/asm

link /usr/include/x86_64-linux-gnu/asm:

ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm

/libstdc++-v3/include/fenv.h ‘::fexcept_t’ has not been declared

or something just like this, simply disable libstdcxx-pch when configure

--disable-libstdcxx-pch

Author: sanye

Exported At 2021-02-24 Wed 23:51. Created by Emacs 26.1 (Org mode 9.4)