Skip to content

Instantly share code, notes, and snippets.

@cwoffenden
Last active April 12, 2022 15:55
Show Gist options
  • Select an option

  • Save cwoffenden/e6a73d8c4bf8473a48fe60d8d543fbeb to your computer and use it in GitHub Desktop.

Select an option

Save cwoffenden/e6a73d8c4bf8473a48fe60d8d543fbeb to your computer and use it in GitHub Desktop.
Building GCC on Power9
# Clone git into a source dir and create a destination for the compiled source:
#
cd path/to/store/files
git clone git://gcc.gnu.org/git/gcc.git gcc-src
mkdir gcc-obj
# Show the list of branches and select the one we want:
#
cd gcc-src
git branch -a
git checkout remotes/origin/releases/gcc-11
# Bootstrap with an earlier GCC:
#
export CC=/usr/bin/gcc-10
# Configure for Power9, named as 'gcc-11' etc., and with dependencies under 'gcc-11' not '11.2.x':
#
cd ../gcc-obj
../gcc-src/configure --with-cpu=power9 --with-tune=power9 --program-suffix=-11 --with-gcc-major-version-only --disable-werror
# Then build a PGO bootstrap (that will compile the compiler to build the final stage):
#
# Note: -flto will fail, so these are as optimised as the build flags get.
#
make -j144 BOOT_CFLAGS='-O3 -g0' profiledbootstrap
# Optional: do a test install to verify the filenames, etc.:
#
# Note: this will fail with relative paths so needs to be absolute.
#
make DESTDIR=path/to/store/files/gcc-out install
# Verify everything is as planned then do a real install:
#
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment