How to cross compile Apple Silicon target under Intel Apple computer ?

Gilles Caulier caulier.gilles at gmail.com
Wed Jan 27 17:10:41 UTC 2021


Hi all,

Just a basic question, but important: can we cross-compile with
Macports a Silicon target with Macports packages using an Intel based
Apple computer ? Typically, I read on the web that Xcode can support
this kind of task.

Advantage: no need to buy a specific M1 computer to build a Silicon
target. Of course I will do it in the future.

We have 3 settings in Macports configuration files where i can tune
this kind of rules :

* macports.conf :
-----------------------

# CPU architecture to target. Supported values are "ppc", "ppc64",
# "i386", and "x86_64". Defaults to:
# - Mac OS X 10.5 and earlier: "ppc" on PowerPC, otherwise "i386".
# - Mac OS X 10.6 and later: "x86_64" on 64-bit Intel, otherwise "i386".
#build_arch             i386

# Space-delimited list of CPU architectures to target when building
# universal. Defaults to "i386 ppc" on Mac OS X 10.5 and earlier,
# "x86_64 i386" on Mac OS X 10.6 through macOS 10.13, and "x86_64" on
# macOS 10.14 and later (the 10.14 SDK is not universal).
#universal_archs        x86_64

* variants.conf :
---------------------

# MacPorts system-wide global variants configuration file.

# Any variants listed here are applied to all port builds. As on the
# command line, variants may be either enabled (+) or disabled (-), and
# unsupported variants are simply ignored.
#
# Each line must be a space- or tab-delimited list of zero or more
# variants.
#
# Example:
#   -x11 +no_x11 +quartz
#   +gcc48
#   +universal

On variants.conf if i put "+universal", this would mean that x86_64
and arm64 binary versions will be embedded in targets ?
How to only embed arm64 ?
What must I set in macports.conf settings file ?

Why I ask this Q : it's simple : I already have a PKG distribution of
my application with only x86_64 symbols. I don't want to make a
secondary PKG with both versions. I would separate the binary versions
: one pkg for intel, one pkg for Silicon, as this last one is very
new, this will take a while to test and stabilize. The Intel version
works well, even in the Rosetta2 emulator.

The target application is digiKam. The list of ports used to compile
the application is huge, so I'm sure to discovers new broken ports for
arm64 targets.

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/macports/01-build-macports.sh#L258

It's not a problem, I will report the dysfunctions step by step...

Thanks in advance for your guidance.

Gilles Caulier


More information about the macports-users mailing list