Skip to content

First contributions

P-E-P edited this page Mar 23, 2024 · 23 revisions

Contributing to this project might appear daunting to some, here is a quick guide that will hopefully help newcomers.

Fork & Clone

It is usually easier for people to work on their own fork of the project. To do so you need to fork the repository and clone it locally on your computer. The first steps we advise are usually the same for everyone, you need to configure and compile the project.

Configure

The configure script will check that your computer has all required dependencies to compile the project. To configure the project, you need to create a directory somewhere that will hold all build artifacts. Note that the root directory of the project should not be used as GCC's build system doesn't really like this but you may create a directory within the project's tree.

mkdir $GCC_TOP_DIR/build && cd $GCC_TOP_DIR/build

This guide will assume you created a build directory at the root of the project's directory.

../configure --disable-bootstrap --enable-multilib --enable-languages=rust

You may want to use some additional flags or specify the compiler (Yes, GCC can be compiled with clang!). Here is another example with some extra configuration:

../configure CC="ccache clang" CXX="ccache clang++" CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" LD_FLAGS="-fuse-ld=mold" --disable-bootstrap --enable-multilib --enable-languages=rust

This configuration will require additional tools but may speedup your workflow.

  • ccache to cache build artifacts.
  • clang because output is less convoluted and there are more warning.
  • Debug informations are enabled.
  • mold is used instead of ld for linking stage.

⚠️ Archlinux may require further configuration. TODO: add required additional options (PIE ?)

Build

You may then build using make. You can specify the amount of jobs that should be used.

make -j32

Testing the compiler

The next step is usually to check wether the compiler works correctly and learn how to launch tests. This can be achieved with the following command.

make check-rust

Note that you can launch the tests on multiple jobs but the output will be a little bit messed up.

  • XFAIL
  • XPASS
  • FAIL
  • PASS
  • UNSUPPORTED