RE-POST March: SPO600 Week 7
This post would be about building GCC.
Instructions to Build GCC
- git clone git://gcc.gnu.org/git/gcc.git
- Create an empty build directory beside the source tree
- Go into the build directory as a non-root user.
- Run the configure script in the source directory using relative path ../gcc/configure
- Add a --prefix=dir option to specify where the software will be installed, plus any other configuration options. The dir should be within the home directory, for example, $HOME/gcc-test-001/
- Run the make -jn option to specify the maximum number of parallel jobs that should be executed at one time, where n is between (#of cores + 1) and (2 * #of cores + 1).
- Run make install as a non-root user. This should install a subdirectory of prefix directory prefix/bin, prefix/lib64
- Add the bin directory to PATH: PATH="prefix/bin:$PATH"
There are 2 ways to build another copy of the same GCC:
- Repeat the steps starting at step 2, creating a new build directory or
- make clean and repeat steps 4 by running the configure script
Connect to the servers, then create a src directory that will have the GCC compiler:
mkdir src
cd src
git clone git://gcc.gnu.org/git/gcc.git
mkdir build
cd build
../gcc/configure --prefix=$HOME/gcc-test-001/
The @....@ are templates and it indicates that the system needs to run a test to find out what value it should insert there.
Then if we look at the Makefile in build folder: less Makefile
Before doing step 6, run the make clean command. Then just for fun, I will also be running the time command to know how long this program would build:
time make -jn
It took a total of 1 hour and 33 minutes to complete building the GCC in AArch64.
It took a total of 1 hour and 30 minutes to complete building the GCC in x86.
To get a tree view: tree ~/gcc-test-001 | less
To check the available disk use: df -h.
For the second build, I decided to use make clean.
Comments
Post a Comment