Opened 14 months ago

Last modified 11 months ago

#70694 new defect

qemu @9.1.0: error: implicit declaration of function 'pthread_jit_write_protect_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

Reported by: tom-programming Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: legacy-os Cc: raimue (Rainer Müller), herbygillot (Herby Gillot), tom-programming, cooljeanius (Eric Gallager), hadrabap (Petr Hadraba), Randrianasulu (Andrew Randrianasulu)
Port: qemu

Description

qemu fails on compilation in macOS 10.15 (Catalina) with newest command line tools

error is:

:info:build In file included from qapi/qapi-visit-authz.c:13:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.1.0/include/qemu/osdep.h:803:5: error: implicit declaration of function 'pthread_jit_write_protect_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     pthread_jit_write_protect_np(true);
:info:build     ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-9.1.0/include/qemu/osdep.h:808:5: error: implicit declaration of function 'pthread_jit_write_protect_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     pthread_jit_write_protect_np(false);
:info:build     ^
:info:build 2 errors generated.

which suggest to me lack of an include pthreads.h directive

Attachments (1)

main.log (497.8 KB) - added by tom-programming 14 months ago.

Download all attachments as: .zip

Change History (9)

Changed 14 months ago by tom-programming

Attachment: main.log added

comment:1 Changed 14 months ago by tom-programming

Cc: tom-programming added

comment:2 Changed 14 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:3 Changed 13 months ago by hadrabap (Petr Hadraba)

Cc: hadrabap added

comment:4 Changed 12 months ago by Randrianasulu (Andrew Randrianasulu)

Cc: Randrianasulu added

comment:5 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: legacy-os added
Summary: qemu @9.1.0 Error on compilation (pthread_jit_write_protect_np)qemu @9.1.0: error: implicit declaration of function 'pthread_jit_write_protect_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

pthread_jit_write_protect_np is only available in macOS 11 and later. I could not find a web page stating that, but in the file /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/pthread/pthread.h on my system the function is declared as:

__API_AVAILABLE(macos(11.0))
__API_UNAVAILABLE(ios, tvos, watchos, driverkit)
void pthread_jit_write_protect_np(int enabled);

The qemu developers deliberately removed the compatibility code that used to allow it to compile on macOS 10.x:

https://gitlab.com/qemu-project/qemu/-/commit/7b60b971cc2f52ed2a69006a2ad709df2831cd67

The maintainer of the qemu port has previous expressed disinterest in supporting older versions of macOS than the developers of qemu do.

Last edited 12 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 12 months ago by cooljeanius (Eric Gallager)

I also get one of these for IOMainPort when compiling on x86_64 Big Sur with Xcode 13, FWIW:

../qemu-9.1.1/block/file-posix.c:3942:18: error: implicit declaration of function 'IOMainPort' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    kernResult = IOMainPort(MACH_PORT_NULL, &mainPort);
                 ^
1 error generated.

(this blocks upgrading of macpine, lima, and colima for me, btw)

Last edited 12 months ago by cooljeanius (Eric Gallager) (previous) (diff)

comment:7 Changed 11 months ago by brendonjkding (Brendon)

Hi, here's all the patches needed to compile on macOS 10.15. Hope it helps. :)

https://github.com/koucyuu/qemu_catalina_patches

comment:8 in reply to:  7 Changed 11 months ago by cooljeanius (Eric Gallager)

Replying to brendonjkding:

Hi, here's all the patches needed to compile on macOS 10.15. Hope it helps. :)

https://github.com/koucyuu/qemu_catalina_patches

Do these fix #71593 too?

Note: See TracTickets for help on using tickets.