Compile GCC
Tested on version 6.5.0
Prerequisites
- MPC
- MPFR
- GMP
Install GMP
Get source code
then
bash
./configure --prefix=<CLONE_DIR>/install
make -j$(nproc)
make check
make install
You can wrap the output install folder into a rez package by creating a package.py
file with the following content:
python
name = "gmp"
version = "<your_version_here>"
def commands():
env.LD_LIBRARY_PATH.prepend("{root}/install/lib")
Install MPFR
Get source code
then
bash
./configure --prefix=<CLONE_DIR>/install --with-gmp=<CLONE_DIR>/install
make -j$(nproc)
make check
make install
You can wrap the output install folder into a rez package by creating a package.py
file with the following content:
python
name = "mpfr"
version = "<your_version_here>"
def commands():
env.LD_LIBRARY_PATH.prepend("{root}/install/lib")
Install MPC
Get source code
then
bash
./configure --prefix=<CLONE_DIR>/install --with-gmp=<CLONE_DIR>/install --with-mpfr=<CLONE_DIR>/install
make -j$(nproc)
make check
make install
You can wrap the output install folder into a rez package by creating a package.py
file with the following content:
python
name = "mpc"
version = "<your_version_here>"
def commands():
env.LD_LIBRARY_PATH.prepend("{root}/install/lib")
Get GCC source
git clone git://gcc.gnu.org/git/gcc.git
you can list all available version with:
git tag -l
then
git checkout <version>
rez env
bash
rez env mpc mpfr gmp
Build
bash
./configure --prefix=<CLONE_DIR>/build --disable-multilib --with-gmp=<GMP+SOURCE_DIR>/install --with-mpfr=<MPFR_SOURCE_DIR>/install --with-mpc=<MPC_SOURCE_DIR>/install
make -j$(nproc)
make check
make install
Exploration build using rez packages build system
GMP/MPC/MPFR
Example with mpc rez package:
py
def commands():
if building:
env.MPC_ROOT = "{root}"
if system.platform == "windows":
env.PATH.append("{root}/bin")
env.PATH.append("{root}/lib")
else:
env.LD_LIBRARY_PATH.prepend("{root}/lib")
then gcc/11.2.0/pacakge.py
py
version = "11.2.0"
build_requires = [
"gmp",
"mpc",
"mpfr",
]
build_system = "make"
def env(var: str):
import platform
if platform.system == 'windows':
return f"$env:{var}"
return f"${var}"
@early()
def build_command():
clone_cmd = ' && '.join([
"git clone git://gcc.gnu.org/git/gcc.git",
"cd gcc",
f"git checkout releases/gcc-{this.version}",
])
configure_cmd = ' && '.join([
f"./configure --prefix={env('REZ_BUILD_INSTALL_PATH')} --disable-multilib --with-gmp={env('GMP_ROOT')} --with-mpfr={env('MPFR_ROOT')} --with-mpc={env('MPC_ROOT')}"
])
build_cmd = ' && '.join([
"make -j $(nproc)",
"make check",
"make install"
])
return f"{clone_cmd} && {configure_cmd} && {build_cmd}"`
rez-build gcc -p <PREFIX_PATH>