From d55dfe241854b9bde570edee15f2f5c5103088df Mon Sep 17 00:00:00 2001 From: csb6 Date: Tue, 31 Aug 2021 18:23:29 -0700 Subject: [PATCH] AK: On macOS host builds, wrap unistd.h with missing extern "C" During the build process on macOS, multiple versions of were being included (Apple's version and GCC's version). It appears that all other places #include the version from GCC, but in Platform.h the Apple header was being used. GCC's is wrapped in `extern "C"`, while Apple's is not. This causes a conflicting declaration, so we need to wrap the #include with extern "C". Issue has been observed on macOS Mojave. See https://github.com/microsoft/vcpkg/issues/11320 for a similar issue. --- AK/Platform.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AK/Platform.h b/AK/Platform.h index ee51bcc3f9..15b3165cf4 100644 --- a/AK/Platform.h +++ b/AK/Platform.h @@ -87,9 +87,17 @@ #endif #ifndef __serenity__ +// On macOS (at least Mojave), Apple's version of this header is not wrapped +// in extern "C". +# ifdef AK_OS_MACOS +extern "C" { +# endif # include # undef PAGE_SIZE # define PAGE_SIZE sysconf(_SC_PAGESIZE) +# ifdef AK_OS_MACOS +}; +# endif #endif #ifdef __cplusplus