Skip to content

Instantly share code, notes, and snippets.

@9xbt
Last active August 17, 2024 19:48
Show Gist options
  • Save 9xbt/41bf1044acea3eff228150d8937eeb74 to your computer and use it in GitHub Desktop.
Save 9xbt/41bf1044acea3eff228150d8937eeb74 to your computer and use it in GitHub Desktop.
Sets up an i386 gcc cross compiler, cross assembler, and cross linker, on Debian-like distros
sudo apt install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo
export PREFIX="/usr/local/i386elfgcc"
export TARGET=i386-elf
export PATH="$PREFIX/bin:$PATH"
mkdir /tmp/src
cd /tmp/src
curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.gz
tar xf binutils-2.42.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-2.42/configure --target=$TARGET --enable-interwork --enable-multilib --disable-nls --disable-werror --prefix=$PREFIX 2>&1 | tee configure.log
sudo make all install 2>&1 | tee make.log
cd /tmp/src
curl -O https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz
tar xf gcc-14.1.0.tar.gz
mkdir gcc-build
cd gcc-build
echo Configure: . . . . . . .
../gcc-14.1.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-libssp --enable-language=c,c++ --without-headers
echo MAKE ALL-GCC:
sudo make all-gcc
echo MAKE ALL-TARGET-LIBGCC:
sudo make all-target-libgcc
echo MAKE INSTALL-GCC:
sudo make install-gcc
echo MAKE INSTALL-TARGET-LIBGCC:
sudo make install-target-libgcc
echo HERE U GO MAYBE:
ls /usr/local/i386elfgcc/bin
export PATH="$PATH:/usr/local/i386elfgcc/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment