Skip to content

Instantly share code, notes, and snippets.

@willeccles
Last active November 7, 2024 20:26
Show Gist options
  • Save willeccles/2db209e37dd15f123c829aeeefc844bd to your computer and use it in GitHub Desktop.
Save willeccles/2db209e37dd15f123c829aeeefc844bd to your computer and use it in GitHub Desktop.
Build the Linaro arm-linux-gnueaibhf-gcc toolchain on macOS.
#! /bin/bash
# source for most of this information: https://stackoverflow.com/a/58852167/2712525
set -e
error() {
echo "failed!"
exit 1
}
trap error ERR
VERSION="7.5-2019.12"
MACOSVER="10.14"
cd /tmp/
echo -n "Downloading... "
wget "https://releases.linaro.org/components/toolchain/gcc-linaro/latest-7/gcc-linaro-$VERSION.tar.xz"
echo "done"
echo -n "Extracting... "
tar -xf "gcc-linaro-$VERSION.tar.xz"
echo "done"
cd "gcc-linaro-$VERSION"
echo -n "Downloading prerequisites... "
./contrib/download_prerequisites
echo "done"
echo -n "Configuring (see config.log)... "
./configure --disable-werror \
--enable-checking=release \
--enable-languages=c,c++ \
--with-native-system-header-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ \
--disable-multilib \
&> config.log
echo "done"
echo -n "Building (see build.log)... "
flags='-mmacosx-version-min=$(MACOSVER) -Wa,-mmacosx-version-min=10.5 -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/'
make -w -j$(nproc) BOOT_CFLAGS="${flags}" CFLAGS_FOR_TARGET="${flags}" CXXFLAGS_FOR_TARGET="${flags}" &> build.log
echo "done"
echo "Build output is located in ${PWD}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment