Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#74047 closed defect (fixed)

py314-meson cross file arm64-darwin missing subsystem = 'macos', breaks glib2-bootstrap +universal on Intel macOS builder

Reported by: Incises (Zhengchao Ding) Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version: 2.12.5
Keywords: Cc:
Port: py314-meson

Description

glib2-bootstrap @2.88.1_0+universal+x11 fails to configure on an Intel macOS builder when building the arm64 slice.

The failure appears to be caused by the Meson Darwin cross file installed by py314-meson:

/opt/local/share/py314-meson/meson/cross/arm64-darwin

not defining:

subsystem = 'macos'

GLib 2.88 calls host_machine.subsystem() on Darwin. Since this is an Intel-to-arm64 cross build, Meson cannot autodetect the Darwin subsystem and configuration fails.

Environment

Build machine: Intel Mac
Build machine arch: x86_64
Target arch: arm64
Xcode clang: Apple clang 14.0.3
SDK: MacOSX13.sdk
Meson: py314-meson, Meson 1.11.1
Port being built: glib2-bootstrap @2.88.1_0+universal+x11

Relevant commands:

sw_vers
xcodebuild -version
xcrun --sdk macosx --show-sdk-version
port version
port installed py314-meson glib2-bootstrap

Failure

Command:

sudo port -v install glib2-bootstrap +universal +x11

Meson is invoked with:

--cross-file=arm64-darwin

The build fails with:

meson.build:84:27: ERROR: Subsystem not defined or could not be autodetected.

Relevant log excerpt:

Build type: cross build
Project name: glib
Project version: 2.88.1

Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: aarch64
Host machine cpu: arm64
Target machine cpu family: aarch64
Target machine cpu: arm64

Cannot run cross check

meson.build:84:27: ERROR: Subsystem not defined or could not be autodetected.

GLib 2.88's meson.build contains:

host_system = host_machine.system()

elif host_system == 'darwin'
subsystem = host_machine.subsystem()
host_system = 'darwin'

Since this is a cross build from x86_64 macOS to arm64 macOS, Meson cannot run the target binary or autodetect the Darwin subsystem.

Current cross file

The cross file installed by py314-meson is:

/opt/local/share/py314-meson/meson/cross/arm64-darwin

It appears to identify the target as Darwin/arm64, but does not define the subsystem as macOS.

Workaround tested

Adding this line under [host_machine] fixes the configure failure:

subsystem = 'macos'

For example:

[host_machine]
system = 'darwin'
subsystem = 'macos'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'

After applying this patch to:

/opt/local/share/py314-meson/meson/cross/arm64-darwin

glib2-bootstrap +universal +x11 configures successfully and the build can continue.

Possible fix

The Meson cross files installed by MacPorts' py*-meson ports should probably include:

subsystem = 'macos'

for macOS Darwin cross files, at least:

arm64-darwin
x86_64-darwin

and possibly the other macOS Darwin cross files as appropriate.

This seems to be a compatibility issue between GLib 2.88's use of host_machine.subsystem() and MacPorts' Meson Darwin cross-file definitions.

Change History (2)

comment:1 Changed 2 months ago by reneeotten (Renee Otten)

Owner: set to reneeotten
Resolution: fixed
Status: newclosed

In 4c73268f93a47cdb367077cdd0fc25a6343b966a/macports-ports (master):

py-meson,meson: explicitly add "subsystem = 'macos'" to cross files

Closes: #74047
Closes: #73976

comment:2 Changed 2 months ago by reneeotten (Renee Otten)

thank you for the analysis and confirming that +universal build works after this change; I have committed your suggested solution to add subsystem = 'macos' to the meson cross-compilation files.

Note: See TracTickets for help on using tickets.