Cross compile GMP for Apple Silicon

Pierre Chatelier pierre at
Sun Nov 22 14:44:14 UTC 2020


I succeeded in cross-compiling GMP from amd64 on a x86_64 build system.
I had overloads of defaults tools in /opt because I use macports.

Here is my build script if it can help others.

For the sake of clarity, I have removed all macros, to show absolute paths. For better compatibility, tools like "xcode-select -p" could be used.

export CC=clang
export CXX=clang
export LD="/Library/Developer/CommandLineTools/usr/bin/ld"
export AR="/Library/Developer/CommandLineTools/usr/bin/ar"
export AS="/Library/Developer/CommandLineTools/usr/bin/as"
export LIBTOOL="/Library/Developer/CommandLineTools/usr/bin/libtool"
export STRIP="/Library/Developer/CommandLineTools/usr/bin/strip"
export RANLIB="/Library/Developer/CommandLineTools/usr/bin/ranlib"
export NM="/Library/Developer/CommandLineTools/usr/bin/nm"
export STRIP="/Library/Developer/CommandLineTools/usr/bin/strip"

export CFLAGS=" -fno-stack-check -isysroot /Applications/ --target=arm64-apple-darwin"
export LDFLAGS=" -isysroot /Applications/ -arch arm64"

./configure --enable-fat --build=x86_64-apple-darwin13.0.0 --host=arm64-apple-darwin

> On 19 Nov 2020, at 00:31, Torbjörn Granlund <tg at> wrote:
> Pierre Chatelier <pierre at> writes:
>  The latest release 6.2.1. I did not try develop branches.
>  Ok, so this is a work in progress.
> Not work-in-progress; arm64-apple-darwin is supported in 6.2.1.  Several
> people have reported that it works.
> I suspect that you did not set up a proper cross compiling environment.
> A glance in the fine GMP manual on this subject might help.  Also,
> reading the output of configure and make should give you some hints.
> -- 
> Torbjörn
> Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list