Opened 2 years ago

Closed 4 weeks ago

#70482 closed defect (fixed)

qemu @9.0.2: error: initializing 'NSEdgeInsets' (aka 'struct NSEdgeInsets') with an expression of incompatible type 'id'

Reported by: RobertPHeller (Robert Heller) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version:
Keywords: catalina legacy-os Cc: herbygillot (Herby Gillot), cooljeanius (Eric Gallager)
Port: qemu

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I am trying to install qemu:

sudo port install qemu

and I am getting an error:

:info:build FAILED: libcommon.fa.p/ui_cocoa.m.o 
:info:build /usr/bin/clang -m64 -mcx16 -Ilibcommon.fa.p -Isubprojects/dtc/libfdt -I../qemu-9.0.2/subprojects/dtc/libfdt -I/opt/local/include/p11-kit-1 -I/opt/local/include/pixman-1 -I/opt/local/include/libpng16 -I/opt/local/include/spice-server -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/libexec/openssl3/include -I/opt/local/include/spice-1 -I/opt/local/include/libusb-1.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include/slirp -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-security -Wformat-y2k -Wignored-qualifiers -Winit-self -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings -Wno-gnu-variable-sized-type-not-at-end -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-tautological-type-limit-compare -Wno-typedef-redefinition -iquote . -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.0.2 -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.0.2/include -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.0.2/host/include/x86_64 -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.0.2/host/include/generic -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.0.2/tcg/i386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -fno-pie -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -D_DARWIN_C_SOURCE -DNCURSES_WIDECHAR -DNCURSES_WIDECHAR=1 -DSTRUCT_IOVEC_DEFINED -MD -MQ libcommon.fa.p/ui_cocoa.m.o -MF libcommon.fa.p/ui_cocoa.m.o.d -o libcommon.fa.p/ui_cocoa.m.o -c ../qemu-9.0.2/ui/cocoa.m
:info:build ../qemu-9.0.2/ui/cocoa.m:542:51: warning: instance method '-safeAreaInsets' not found (return type defaults to 'id') [-Wobjc-method-access]
:info:build     NSEdgeInsets insets = [[[self window] screen] safeAreaInsets];
:info:build                                                   ^~~~~~~~~~~~~~
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSScreen.h:20:12: note: receiver is instance of class declared here
:info:build @interface NSScreen : NSObject
:info:build            ^
:info:build ../qemu-9.0.2/ui/cocoa.m:542:18: error: initializing 'NSEdgeInsets' (aka 'struct NSEdgeInsets') with an expression of incompatible type 'id'
:info:build     NSEdgeInsets insets = [[[self window] screen] safeAreaInsets];
:info:build                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 1 warning and 1 error generated.
:info:build [1076/3645] /usr/bin/clang -m64 -mcx16 -Ilibcommon.fa.p -Isubproject

Change History (3)

comment:1 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: herbygillot added
Description: modified (diff)
Keywords: catalina legacy-os added
Owner: set to raimue
Port: qemu added
Status: newassigned
Summary: Error while installing qemu on Catalina (10.15.7)qemu @9.0.2: error: initializing 'NSEdgeInsets' (aka 'struct NSEdgeInsets') with an expression of incompatible type 'id'

The qemu port enables the cocoa variant by default on macOS 10.14 and older. It may be the case that due to changes in the qemu code this variant can no longer build on 10.15. Try building without the cocoa variant:

sudo port clean qemu
sudo port install qemu -cocoa
Last edited 2 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 Changed 2 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:3 Changed 4 weeks ago by herbygillot (Herby Gillot)

Resolution: fixed
Status: assignedclosed

In aae3f6252a00ef40c3dbdcdb4bf0fa08c4c7f83a/macports-ports (master):

qemu: fix build on macOS 11 and earlier

qemu 11.1.0 fails on every buildbot below macOS 12, from 10.6 through 11
on both arches, while 12 and later are green apart from an unrelated
arm64 failure on 12. The cutoff falls where Apple's macOS 11 and 12 API
additions and inclusive-language renames landed. This is not a
compiler-selection problem: the port already sets compiler.blacklist
{clang < 1500} and is therefore already building with macports-clang.
Each failure is a symbol the older SDK does not declare, and since the
port declares no floor and carries deliberate support back to darwin 10,
these are regressions rather than unsupported setups.

Adds seven patchfiles guarding APIs that older SDKs lack:
pthread_jit_write_protect_np (macOS 11), IOMainPort (12),
kAudioObjectPropertyElementMain (12), -[NSScreen safeAreaInsets] (12),
HV_DENIED (11), HV_DEADLINE_FOREVER with hv_vcpu_run_until (11 and
10.15), and timespec_get/TIME_UTC (10.15); and disables vmnet below
darwin 20. Every threshold was read from Apple's own SDK headers on the
target systems rather than from documentation. Constants are guarded on
MAC_OS_X_VERSION_MAX_ALLOWED, since they need only be declared; functions
and Objective-C methods on MAC_OS_X_VERSION_MIN_REQUIRED, since referring
to them below the deployment target would fail at run time even when a
newer SDK declares them.

Two are not simple defines. hv_vcpu_run_until() is annotated HV_10_15,
so below 10.15 the function itself is absent and no #define can help; the
shim falls back to hv_vcpu_run(), which Apple's macOS 11 header documents
as its equivalent for an infinite deadline, keeping HVF acceleration
instead of dropping those hosts to TCG. vmnet is an upstream detection
bug: meson probes for VMNET_BRIDGED_MODE, which 10.15 does have, and then
compiles net/vmnet-* against macOS 11 symbols that it does not.

Verified by full clean builds on 10.14.6, 10.15.7 and 11.7.10 with zero
patch failures and HVF present in each. Because the macOS 11 test host
carried an SDK newer than its OS, a second build there pinned to an 11.3
SDK exercises the other branch of the macOS 12 guards. Symbol selection
was confirmed against the built binaries. Not tested below 10.14, on
arm64, or with a running guest.

Closes: #70694
Closes: #72042
Closes: #70482
Assisted-by: Claude:claude-opus-5
Co-Authored-By: Claude Opus 5 <noreply@…>

Note: See TracTickets for help on using tickets.