|
| 1 | +**Goal: Update our build system to El Capitan** |
| 2 | + |
| 3 | +If you were following this guide from the beginning, and upgraded to El Capitan only |
| 4 | +to find that Makefiles don't compile anymore, follow these instructions to upgrade |
| 5 | +your cross-compiler. |
| 6 | + |
| 7 | +Otherwise, move on to the next lesson |
| 8 | + |
| 9 | +Upgrading the cross-compiler |
| 10 | +---------------------------- |
| 11 | + |
| 12 | +We will follow the same instructions as in lesson 11, more or less. |
| 13 | + |
| 14 | +First, run `brew upgrade` and you will get your gcc upgraded to version 5.0 (at the time this guide was written) |
| 15 | + |
| 16 | +Then run `xcode-select --install` to update OSX commandline tools |
| 17 | + |
| 18 | +Once installed, find where your packaged gcc is (remember, not clang) and export it. For example: |
| 19 | + |
| 20 | +``` |
| 21 | +export CC=/usr/local/bin/gcc-5 |
| 22 | +export LD=/usr/local/bin/gcc-5 |
| 23 | +``` |
| 24 | + |
| 25 | +We will need to recompile binutils and our cross-compiled gcc. Export the targets and prefix: |
| 26 | + |
| 27 | +``` |
| 28 | +export PREFIX="/usr/local/i386elfgcc" |
| 29 | +export TARGET=i386-elf |
| 30 | +export PATH="$PREFIX/bin:$PATH" |
| 31 | +``` |
| 32 | + |
| 33 | +binutils |
| 34 | +-------- |
| 35 | + |
| 36 | +Rember: always be careful before pasting walls of text from the internet. I recommend copying line by line. |
| 37 | + |
| 38 | +```sh |
| 39 | +mkdir /tmp/src |
| 40 | +cd /tmp/src |
| 41 | +curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.gz # If the link 404's, look for a more recent version |
| 42 | +tar xf binutils-2.24.tar.gz |
| 43 | +mkdir binutils-build |
| 44 | +cd binutils-build |
| 45 | +../binutils-2.24/configure --target=$TARGET --enable-interwork --enable-multilib --disable-nls --disable-werror --prefix=$PREFIX 2>&1 | tee configure.log |
| 46 | +make all install 2>&1 | tee make.log |
| 47 | +``` |
| 48 | + |
| 49 | + |
| 50 | +gcc |
| 51 | +--- |
| 52 | +```sh |
| 53 | +cd /tmp/src |
| 54 | +curl -O http://mirror.bbln.org/gcc/releases/gcc-4.9.1/gcc-4.9.1.tar.bz2 |
| 55 | +tar xf gcc-4.9.1.tar.bz2 |
| 56 | +mkdir gcc-build |
| 57 | +cd gcc-build |
| 58 | +../gcc-4.9.1/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-libssp --enable-languages=c --without-headers |
| 59 | +make all-gcc |
| 60 | +make all-target-libgcc |
| 61 | +make install-gcc |
| 62 | +make install-target-libgcc |
| 63 | +``` |
| 64 | + |
0 commit comments