Abe requires Bash version 4+.
brew install bash autogen dejagnu coreutils gcc gawk #binutils
#brew install libmpc gmp mpf
for ubuntu apt install flex bison autogen texinfo gawk zlib1g-dev libncurses5-dev libpython2.7-dev dejagnu gcc g++ wget curl make automake rsync python expect
gcc 7 doesn’t compile with guile 2.2, so you have to downgrade it:
brew uninstall --ignore-dependencies guile
brew install guile@2.0
Be aware that guile will live /usr/local/opt/[email protected] and you need additional actions to move it to /usr/local
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
==> Caveats
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfi
date: illegal option -- -
ln -s gdate /usr/local/bin/date
If you met error about epsond git-new-workdir
fix it with
curl -L https://raw.githubusercontent.com/git/git/master/contrib/workdir/git-new-workdir >/usr/local/bin/git-new-workdir && chmod +x /usr/local/bin/git-new-workdir
GCC built by Homebrew adds /usr/local/bin/gcc-8
but not gcc
cd /usr/local/bin
ln -s c++-8 c++
ln -s cpp-8 cpp
ln -s g++-8 g++
ln -s gcc-8 gcc
ln -s gcc-ar-8 gcc-ar
ln -s gcc-nm-8 gcc-nm
ln -s gcc-ranlib-8 gcc-ranlib
ln -s gcov-8 gcov
ln -s gcov-dump-8 gcov-dump
ln -s gcov-tool-8 gcov-tool
#ln -s gfortran-8 gfortran
- Get ABE
git clone https://git.linaro.org/toolchain/abe.git --depth 1 --single-branch -b master
cd abe
Make sure /bin/sh
and /bin/bash
are pointing to /usr/local/bin/bash
or modify shebangs in scripts.
On MacOS /bin/bash
is very old version 3.2.57 (2007).
Modify shebangs in Abe's Bash scripts:
find . -name '*.sh' -type f -print0 | xargs -0 sed -i '' -e 's|#!/bin/bash|#!/usr/bin/env bash|g' -e 's|#!/bin/sh|#!/usr/bin/env bash|g'
Note: ''
after -i
is required for old default MacOS's sed
and not for newer GNU sed
.
Prepare build
cd ..
mkdir build
cd build
../abe/configure
Open /abe/config/sources.conf
and change gcc url to ‘http://snapshots.linaro.org/components/toolchain/gcc-linaro/5.2-2015.11’
look at this link or the similar one for other version you’re interested in xxx_revision and xxx_filespec values, replace then in following command if needed
$ ../abe/abe.sh --target arm-linux-gnueabihf gcc=gcc.git@5104f2473987407575bfc63ee965394252433bb5 binutils=binutils-gdb.git@e0f59b0a7b5a2d879b0afc665ca0f28fb5b3d54e glibc=glibc.git@02aaa3c749bf18a3dbafff4c1f0180f135cad7ed --release 2017.08 --tarbin --build all
# we probably should replace --build all with --checkout all in previous command:
$ ../abe/abe.sh --target arm-linux-gnueabihf gcc=gcc.git@5104f2473987407575bfc63ee965394252433bb5 binutils=binutils-gdb.git@e0f59b0a7b5a2d879b0afc665ca0f28fb5b3d54e glibc=glibc.git@02aaa3c749bf18a3dbafff4c1f0180f135cad7ed --release 2017.08 --tarbin --checkout all
For 5.2:
../abe/abe.sh --target arm-linux-gnueabihf gcc=gcc-linaro-snapshot-5.2-2015.11.tar.xz binutils=binutils-gdb.git@ef90a4718f535cbe6345b4e7168baea7b1972abf glibc=glibc.git@dbcaca73cb0a19698ea1b424087e8997a9b7c3c4 --release 2015.11 --tarbin --checkout all
# you should fail :D
# patch ./snapshots/glibc.git~master_rev_<revision>/sunrpc/Makefile: add “BUILD_LDFLAGS += -L/usr/local/lib -lintl” near BUILD_ CPPFLAGS
# restart build without downloading
$ ../abe/abe.sh --disable update --target arm-linux-gnueabihf gcc=gcc.git@5104f2473987407575bfc63ee965394252433bb5 binutils=binutils-gdb.git@e0f59b0a7b5a2d879b0afc665ca0f28fb5b3d54e glibc=glibc.git@02aaa3c749bf18a3dbafff4c1f0180f135cad7ed --release 2017.08 --tarbin --build all
../abe/abe.sh --disable update --target arm-linux-gnueabihf gcc=gcc-linaro-snapshot-5.2-2015.11.tar.xz binutils=binutils-gdb.git@ef90a4718f535cbe6345b4e7168baea7b1972abf glibc=glibc.git@dbcaca73cb0a19698ea1b424087e8997a9b7c3c4 --release 2015.11 --tarbin --build all
You should fail
Open ‘builds/<host_arch>/binutils<revision>/gold/Makefile’ or `/snapshots/binutils-gdb.git~master_rev_<revision>/gold/Makefile.in` and add ‘diststuff: $(EXTRA_DIST) info’ to line ~1331
Goto makefiles and replace this:
gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C
to this:
gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++
- https://vivinuthappa.wordpress.com/articles/build-from-source-an-official-release-of-linaro-toolchain/
- https://wiki.linaro.org/ABE
- https://wiki.osdev.org/GCC_Cross-Compiler
- https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
- https://solarianprogrammer.com/2018/05/06/building-gcc-cross-compiler-raspberry-pi/
- https://www.linux.com/blog/cross-compiling-arm
- https://solarianprogrammer.com/2017/05/21/compiling-gcc-macos/
- https://wiki.linaro.org/WorkingGroups/ToolChain/FAQ
- http://www.linuxfromscratch.org/lfs/view/development/index.html
- https://releases.linaro.org/components/toolchain/gcc-linaro/
- https://wiki.linaro.org/Toolchain
- https://docs.google.com/document/d/1CL6u_NXTDDEXnie64JDKkjcKCTyNDh_3IFTg06bpACY/edit# by Max Lepekh
- https://git.linaro.org
- https://releases.linaro.org/components/toolchain/gcc-linaro/
- https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads