Skip to content

Instantly share code, notes, and snippets.

@abrodkin
Last active June 8, 2022 14:43
Show Gist options
  • Save abrodkin/12e5c25d97a3969ed5ad6c99e3c7d824 to your computer and use it in GitHub Desktop.
Save abrodkin/12e5c25d97a3969ed5ad6c99e3c7d824 to your computer and use it in GitHub Desktop.

Preparation of the build host:

  1. Clone osxcross repo: git clone https://github.com/tpoechtrager/osxcross
  2. cd osxcross
  3. Download MacOS SDK: curl -sLo tarballs/MacOSX10.10.sdk.tar.xz https://www.dropbox.com/s/yfbesd249w10lpc/MacOSX10.10.sdk.tar.xz
  4. Run container for building

CentOS 8.x

docker run -v $PWD:/osxcross --name centos8-osxcross -i -t centos:centos8 /bin/bash

# Required to enable PowerTools repo
dnf -y install dnf-plugins-core
# Required for libmpc-devel
dnf config-manager --set-enabled PowerTools

dnf install -y automake libtool libxml2-devel patch make xz bzip2 gcc gcc-c++ libmpc mpfr-devel gmp-devel git autoconf binutils bison zlib-devel wget diffutils which openssl-devel libmpc-devel texinfo python3-pip

CentOS 7.x

docker run -v $PWD:/osxcross --name centos7-osxcross -i -t centos:centos7 /bin/bash

yum install -y automake libtool libxml2-devel patch make xz bzip2 gcc gcc-c++ libmpc mpfr-devel gmp-devel git autoconf binutils bison zlib-devel wget diffutils which openssl-devel libmpc-devel texinfo python3-pip

Build osxcross

# LLVM 9 requires much newer Cmake, so get it via Pip
pip3 install cmake
cd /osxcross
ENABLE_CLANG_INSTALL=1 INSTALLPREFIX=/u/svc-arcoss_auto/tools/osxcross UNATTENDED=1 ./build_clang.sh
cd /osxcross/build/llvm-9.0.0.src/build_stage2 && make install
cd /osxcross
TARGET_DIR=/u/svc-arcoss_auto/tools/osxcross SDK_VERSION=10.10 OSX_VERSION_MIN=10.6 UNATTENDED=1 ./build.sh
export PATH=/u/svc-arcoss_auto/tools/osxcross/bin:$PATH
TARGET_DIR=/u/svc-arcoss_auto/tools/osxcross ./build_gcc.sh
TARGET_DIR=/u/svc-arcoss_auto/tools/osxcross ./build_binutils.sh
cd /u/svc-arcoss_auto/tools
tar -czvf osxcross.tar.gz osxcross/
mv osxcross.tar.gz /osxcross/

On destination host:

tar -xvf osxcross.tar.gz
cp -r * /u/svc-arcoss_auto/tools/osxcross/
export PATH=/u/svc-arcoss_auto/tools/osxcross/bin/:$PATH

Test Crosstool-NG defconfig:

CT_CONFIG_VERSION="3"
CT_ARCH_ARC=y
CT_TARGET_ALIAS="arc-elf32"
CT_CANADIAN=y
CT_HOST="x86_64-apple-darwin14"
CT_CC_GCC_SYSTEM_ZLIB=y
# CT_CC_GCC_USE_LTO is not set
# CT_LIBICONV_NEEDED is not set
# CT_GETTEXT_NEEDED is not set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment