GCC Cross Compiler - Mac installation

less than 1 minute read

Creating a Cross compiler on Mac

Download

mkdir -p $HOME/opt/cross

export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"

mkdir src && cd src

# Keep the build files of binutils

mkdir build-binutils && cd build-binutils
../binutils-2.43/configure --target==$TARGET --prefix=="$PREFIX" --with-sysroot
--disable-nls --disable-werror
make
make install

Build GCC

mkdir build-gcc   
cd build-gcc  
../gcc-14.2.0/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c,c++ --without-headers

make clean
make all-gcc
make all-target-libgcc

The required libraries for MacBook. It is better to use Ubuntu to be able to develop seemlessly

brew install build-essesntial
brew install bison
brew install flex
brew install libgmp3-dev
brew install libmpc
brew install texinfo
brew install libidl