Opened 4 weeks ago

Last modified 10 days ago

#71857 assigned defect

qemu @9.2.0_0 +cocoa+curses+spice+spice_protocol+ssh+target_arm+target_i386+target_x86_64+usb+vnc: error: call to undeclared function 'hv_vm_config_get_default_ipa_size'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Reported by: lafpark Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: monterey arm64 Cc: herbygillot (Herby Gillot)
Port: qemu

Description

OSX 12.6 XCode: Version 14.2 (14C18) Apple M1 Pro

qemu fails to build, referencing unknown functions:

:info:build ../qemu-9.2.0/target/arm/hvf/hvf.c:925:23: error: call to undeclared function 'hv_vm_config_get_default_ipa_size'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build   925 |     hv_return_t ret = hv_vm_config_get_default_ipa_size(&default_ipa_size);
:info:build       |                       ^
:info:build ../qemu-9.2.0/target/arm/hvf/hvf.c:934:23: error: call to undeclared function 'hv_vm_config_get_max_ipa_size'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build   934 |     hv_return_t ret = hv_vm_config_get_max_ipa_size(&max_ipa_size);
:info:build       |                       ^
:info:build ../qemu-9.2.0/target/arm/hvf/hvf.c:974:29: error: call to undeclared function 'hv_vm_config_create'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build   974 |     hv_vm_config_t config = hv_vm_config_create();
:info:build       |                             ^
:info:build ../qemu-9.2.0/target/arm/hvf/hvf.c:974:29: note: did you mean 'hv_vcpu_config_create'?
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Hypervisor.framework/Headers/hv_vcpu_config.h:28:1: note: 'hv_vcpu_config_create' declared here
:info:build    28 | hv_vcpu_config_create(void);
:info:build       | ^
:info:build ../qemu-9.2.0/target/arm/hvf/hvf.c:974:20: error: incompatible integer to pointer conversion initializing 'hv_vm_config_t' (aka 'struct hv_vm_config_s *') with an expression of type 'int' [-Wint-conversion]
:info:build   974 |     hv_vm_config_t config = hv_vm_config_create();
:info:build       |                    ^        ~~~~~~~~~~~~~~~~~~~~~
:info:build ../qemu-9.2.0/target/arm/hvf/hvf.c:976:11: error: call to undeclared function 'hv_vm_config_set_ipa_size'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build   976 |     ret = hv_vm_config_set_ipa_size(config, pa_range);
:info:build       |           ^
:info:build 5 errors generated.

The previous version was successfully built and installed. qemu @9.1.1_0+cocoa+curses+spice+spice_protocol+ssh+target_arm+target_i386+target_x86_64+usb+vnc

Attachments (1)

main.log (5.0 MB) - added by lafpark 4 weeks ago.
Compilation log file

Change History (7)

comment:1 Changed 4 weeks ago by ryandesign (Ryan Carsten Schmidt)

Cc: herbygillot added
Keywords: monterey added; Monterey qemu removed
Owner: set to raimue
Status: newassigned
Summary: qemu @ 9.2.0_0 +cocoa+curses+spice+spice_protocol+ssh+target_arm+target_i386+target_x86_64+usb+vnc Build Failureqemu @9.2.0_0 +cocoa+curses+spice+spice_protocol+ssh+target_arm+target_i386+target_x86_64+usb+vnc: error: call to undeclared function 'hv_vm_config_get_default_ipa_size'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Please attach the main.log file.

Changed 4 weeks ago by lafpark

Attachment: main.log added

Compilation log file

comment:2 Changed 4 weeks ago by lafpark

Log file uploaded.

comment:3 Changed 11 days ago by lafpark

When configuring, the warning is reported

Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
  pthread_condattr_setclock: found in build/meson-logs/meson-log.txt
  CPU_ALLOC_SIZE: found in build/meson-logs/meson-log.txt
  CPU_ALLOC: found in build/meson-logs/meson-log.txt
  CPU_ZERO_S: found in build/meson-logs/meson-log.txt
  pthread_setaffinity_np: found in build/meson-logs/meson-log.txt
  pthread_getaffinity_np: found in build/meson-logs/meson-log.txt
  CPU_FREE: found in build/meson-logs/meson-log.txt

I'm not sure if that's related.

comment:4 Changed 11 days ago by biggreenogre (BigGreenOgre)

I am experiencing this issue with MacOS Monterey (12.7.6) and noticed that the Apple Developer docs say that the function "hv_vm_config_create", called at target/arm/hvf/hvf.c:974, requires macOS 13.0+ ref: https://developer.apple.com/documentation/hypervisor/3666561-hv_vm_config_create?changes=_8_1&language=objc

The other functions in the error message, hv_vm_config_get_default_ipa_size, hv_vm_config_get_max_ipa_size and hv_vm_config_set_ipa_size have the same note. ref: https://developer.apple.com/documentation/hypervisor/hypervisor_functions?changes=_8_1&language=objc

Last edited 11 days ago by biggreenogre (BigGreenOgre) (previous) (diff)

comment:5 Changed 10 days ago by ryandesign (Ryan Carsten Schmidt)

Keywords: arm64 added

The problem seems specific to Apple Silicon Macs. The build failed on macOS 12 on our arm64 buildbot but succeeded on macOS 12 on x86_64.

comment:6 Changed 10 days ago by raimue (Rainer Müller)

This observation seems correct to me. The problem occurs in target/arm/hvf/hvf.c that is only compiled on arm64 for Hypervisor.framework.

Upstream regularly drops support for older macOS releases and consequently removes any #ifdef guards in the code. The current qemu version officially only supports macOS >= 13. We were lucky that the build worked at all on macOS 12 x86_64.

The upstream commit introducing the problem for macOS 12 seems to be this one: https://github.com/qemu/qemu/commit/2c760670af5f013d99d50f627275a482fd491e3f

As a workaround, we might still be able to build without support for Hypervisor.framework with --disable-hvf as a configure option on macOS 12 arm64 as a workaround. However, that would result in a QEMU that has no hardware acceleration and will be of limited use.

Alternatively, this completely untested patch could help (if there are not more places like this one), but I have no macOS12 arm64 machine to try this:

  • target/arm/hvf/hvf.c

    diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
    index 0afd96018..f7b4b4392 100644
    a b void hvf_arch_vcpu_destroy(CPUState *cpu) 
    972972
    973973hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range)
    974974{
     975#if defined(MAC_OS_VERSION_13_0) && \
     976    MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_13_0
    975977    hv_return_t ret;
    976978    hv_vm_config_t config = hv_vm_config_create();
    977979
    hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range) 
    982984    chosen_ipa_bit_size = pa_range;
    983985
    984986    ret = hv_vm_create(config);
     987#else
     988    ret = hv_vm_create(HV_VM_DEFAULT);
     989#endif
    985990
    986991cleanup:
    987992    os_release(config);
Note: See TracTickets for help on using tickets.