Skip to content

Instantly share code, notes, and snippets.

@radekg
Created November 1, 2024 17:15
Show Gist options
  • Save radekg/3e079bfc3824f268b7eb9f9197a67be5 to your computer and use it in GitHub Desktop.
Save radekg/3e079bfc3824f268b7eb9f9197a67be5 to your computer and use it in GitHub Desktop.
Installing Ada on arm macOS
brew install texinfo bison m4 flex
curl -L https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-13.2.0-1/gnat-x86_64-darwin-13.2.0-1.tar.gz | tar xzf -
git clone --depth=1 https://github.com/iains/gcc-13-branch gcc-13.2.0
export PATH=$PWD/gnat-x86_64-darwin-13.2.0-1/bin:$PATH
cd gcc-13.2.0
./contrib/download_prerequisites
mkdir ../build
cd ../build
CC="x86_64-apple-darwin21.6.0-gcc" CXX="x86_64-apple-darwin21.6.0-g++" \
../gcc-13.2.0/configure \
--prefix=/usr/local \
--enable-languages=c,ada,c++ \
--enable-libstdcxx --enable-libstdcxx-threads --enable-libada --disable-nls \
--without-libiconv-prefix --disable-libstdcxx-pch \
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk \
--without-target-system-zlib \
--with-as=/usr/bin/as --with-ar=/usr/bin/ar --with-ld=/usr/bin/ld \
--with-dsymutil=/usr/bin/dsymutil --with-ranlib=/usr/bin/ranlib \
--disable-multilib --disable-libcilkrts --without-build-config \
--with-specs='%{!sysroot=*:--sysroot=%:if-exists-else(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk)}'\
--target=aarch64-apple-darwin21.6.0 --build=x86_64-apple-darwin21.6.0 \
AS_FOR_TARGET=/usr/bin/as LD_FOR_TARGET=/usr/bin/ld \
NM_FOR_TARGET=/usr/bin/nm RANLIB_FOR_TARGET=/usr/bin/ranlib \
AR_FOR_TARGET=/usr/bin/ar LIPO_FOR_TARGET=/usr/bin/lipo \
DSYMUTIL_FOR_TARGET=/usr/bin/dsymutil \
STRIP_FOR_TARGET=/usr/bin/strip
make -j4 all
make install-strip DESTDIR=$PWD/../destdir
# missing files required to rebuild RTS
cp -v gcc/ada/rts/*.{c,h,gpr,lst} ../gcc-13.2.0/libgcc/unwind-pe.h \
../destdir/usr/local/lib/gcc/aarch64-apple-darwin21.6.0/13.2.0/adainclude/
cd ..
tar cavf aarch64-macOS-gcc-13.2.tar.bz2 -C destdir .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment