Skip to content

GCC 13.1.0 (aarch64)

Compare
Choose a tag to compare
@simonjwright simonjwright released this 07 Dec 11:54
· 43 commits to main since this release
gcc-13.1.0-aarch64-2

This is GCC 13.1.0 built on macOS Ventura (13, Darwin 22) but able to run on Monterey, for Apple silicon (M1), with Command Line Utilities 14.2.0 and Python 3.9.13.

Compiler sources are from https://github.com/iains/gcc-13-branch at tag gcc-13.1-darwin-r0.

Compilers included: Ada, C, C++.

Tools included (all at version 23.0.0, and all with the Runtime Library Exception):

Configured with:

--prefix=/opt/gcc-13.1.0-aarch64
--without-libiconv-prefix
--disable-libmudflap
--disable-libstdcxx-pch
--disable-libsanitizer
--disable-libcc1
--disable-libcilkrts
--disable-multilib
--disable-nls
--enable-languages=c,c++,ada
--host=aarch64-apple-darwin21
--target=aarch64-apple-darwin21
--build=aarch64-apple-darwin21
--without-isl
--with-build-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
--with-sysroot=
--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)}'
--with-as=/usr/bin/as
--with-ld=/usr/bin/ld
--with-ranlib=/usr/bin/ranlib
--with-dsymutil=/usr/bin/dsymutil
--with-build-config=no
--enable-bootstrap
CFLAGS=-Wno-deprecated-declarations
CXXFLAGS=-Wno-deprecated-declarations

Install

One of Xcode or the Command Line Tools is required.

Xcode can be downloaded from the App Store.
Install the Command Line Tools by sudo xcode-select --install.

If you suspect your copy of the Command Line Tools is old, you can delete it by

sudo rm -rf /Library/Developer/CommandLineTools

and re-install.

Download the binary .pkg. It's not signed, so don't double-click on it; instead, right-click on it and Open. Accept the warning. You will be guided through the installation.

Setting PATH

PATH needs to be set to include /opt/gcc-13.1.0-aarch64/bin at the front:

bash

Insert

export PATH=/opt/gcc-13.1.0-aarch64/bin:$PATH

in your ~/.bash_profile_common.

zsh

Likewise, but in ~/.zshrc.

See here for helpful information on moving to zsh.

Notes

The software was built using the building-gcc-macos-native scripts at Github, tag gcc-13.1.0-aarch64-2.

All compilations were done with export MACOSX_DEPLOYMENT_TARGET=12 so that libraries and executables are compatible with macOS Monterey and later.

Compiler

The compiler is GPL version 3. The runtime has the GCC Runtime Exception, so executables built with it can be released on proprietary terms.

GMP, MPFR, MPC

These libraries (releases 6.2.1, 4.1.0, 1.2.1 respectively) are installed with the compiler.

Other sources

The following patches to the v23.0.0 versions were needed to allow the builds to see the new compiler.

XML/Ada

diff --git a/Makefile.in b/Makefile.in
index 14d3dc4..26707d7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -35,13 +35,9 @@ MODULES=unicode input_sources sax dom schema
 MODULE_INSTALL=${MODULES:%=%_inst}

 GPROPTS=-XXMLADA_BUILD_MODE=${MODE} -XPROCESSORS=${PROCESSORS}
+GPROPTS+=--target=${TARGET_ALIAS}

-ifeq (${HOST},${TARGET})
 IPREFIX=${DESTDIR}${prefix}
-else
-GPROPTS+=--target=${TARGET_ALIAS}
-IPREFIX=${DESTDIR}${prefix}/${TARGET_ALIAS}
-endif

 ifdef RTS
 GPROPTS+=--RTS=${RTS}

Gprbuild

diff --git a/Makefile b/Makefile
index d4de8894..6fddd346 100644
--- a/Makefile
+++ b/Makefile
@@ -37,13 +37,7 @@ LIB_DIR       = lib/
 # Load current setup if any
 -include makefile.setup

-# target options for cross-build
-ifeq ($(HOST),$(TARGET))
-GTARGET=
-# INSTALLER=exe/$(BUILD)/$(LIB_INSTALLER)
-else
 GTARGET=--target=$(TARGET)
-endif

 INSTALLER=$(LIB_INSTALLER)
 EXEC_INSTALLER=$(INSTALLER) -XBUILD=${BUILD}

and (see gprbuild issue 141)

diff --git a/src/gprlib.adb b/src/gprlib.adb
index d7547b1d..20abd33a 100644
--- a/src/gprlib.adb
+++ b/src/gprlib.adb
@@ -923,7 +923,7 @@ procedure Gprlib is
          if Separate_Run_Path_Options then
             for J in 1 .. Rpath.Last_Index loop
                Options_Table.Append
-                 (Concat_Paths (Path_Option, " ") & ' ' & Rpath (J));
+                 (Concat_Paths (Path_Option, " ") & Rpath (J));
             end loop;

          else

Include, library paths

As noted here, Apple have changed the location of system include files and libraries; they used to be copied from the SDKs to the "standard" /usr/include and /usr/lib either automatically or on command.

This compiler has been built so you don't need to take any related action to use it: unfortunately, this means that paths in /usr/local and /Library/Frameworks aren't searched.