failure to build on macos with `-Werror=unguarded-availability-new`
asottile-sentry opened this issue · comments
also reported here: indygreg/python-build-standalone#210
here's a quick reproduction:
wget https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.12.1+20240107-x86_64-apple-darwin-pgo+lto-full.tar.zst
tar -xf cpython-3.12.1+20240107-x86_64-apple-darwin-pgo+lto-full.tar.zst
./python/install/bin/python3 -m pip wheel watchdog --no-deps
fails with:
...
running build_ext
building '_watchdog_fsevents' extension
creating build/temp.macosx-10.9-x86_64-cpython-312
creating build/temp.macosx-10.9-x86_64-cpython-312/src
clang -fno-strict-overflow -DNDEBUG -g -O3 -Wall -arch x86_64 -mmacosx-version-min=10.9 -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-undef-prefix -fPIC -Werror=unguarded-availability-new -DWATCHDOG_VERSION_STRING=\"3.0.0\" -DWATCHDOG_VERSION_MAJOR=3 -DWATCHDOG_VERSION_MINOR=0 -DWATCHDOG_VERSION_BUILD=0 -I/private/tmp/y/qq/python/install/include/python3.12 -c src/watchdog_fsevents.c -o build/temp.macosx-10.9-x86_64-cpython-312/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-nullability-completeness -Wno-nullability-extension -Wno-newline-eof -Wno-error=unused-command-line-argument
src/watchdog_fsevents.c:191:25: error: 'kFSEventStreamEventFlagItemCloned' is only available on macOS 10.13 or newer [-Werror,-Wunguarded-availability-new]
FLAG_PROPERTY(IsCloned, kFSEventStreamEventFlagItemCloned)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/watchdog_fsevents.c:163:27: note: expanded from macro 'FLAG_PROPERTY'
if (self->flags & flag) { \
^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:544:3: note: 'kFSEventStreamEventFlagItemCloned' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
kFSEventStreamEventFlagItemCloned __OSX_AVAILABLE_STARTING(__MAC_10_13, __IPHONE_11_0) = 0x00400000
^
src/watchdog_fsevents.c:191:25: note: enclose 'kFSEventStreamEventFlagItemCloned' in a __builtin_available check to silence this warning
FLAG_PROPERTY(IsCloned, kFSEventStreamEventFlagItemCloned)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/watchdog_fsevents.c:163:27: note: expanded from macro 'FLAG_PROPERTY'
if (self->flags & flag) { \
^~~~
src/watchdog_fsevents.c:596:40: error: 'kFSEventStreamCreateFlagUseExtendedData' is only available on macOS 10.13 or newer [-Werror,-Wunguarded-availability-new]
| kFSEventStreamCreateFlagUseExtendedData
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:294:3: note: 'kFSEventStreamCreateFlagUseExtendedData' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
kFSEventStreamCreateFlagUseExtendedData __OSX_AVAILABLE_STARTING(__MAC_10_13, __IPHONE_11_0) = 0x00000040,
^
src/watchdog_fsevents.c:596:40: note: enclose 'kFSEventStreamCreateFlagUseExtendedData' in a __builtin_available check to silence this warning
| kFSEventStreamCreateFlagUseExtendedData
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for watchdog
Failed to build watchdog
ERROR: Failed to build one or more wheels
[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: /private/tmp/y/qq/python/install/bin/python3 -m pip install --upgrade pip
I do not have a Mac to try something.
Do you know if watchdog 4.0.0 changes something with the issue? (The release was cut a few minutes ago, and it brings Python 3.12 support.)
still fails in the same way for 4.0.0 (when using --no-binary :all:
to force building from source)
Do you need to force the build from sources when a wheel is provided?
usually I don't but I'd like to be able to reproduce the builds
this fixes it for me fwiw -- and matches with the #error
in the code:
diff --git a/setup.py b/setup.py
index 320d951..644d2b7 100644
--- a/setup.py
+++ b/setup.py
@@ -71,6 +71,7 @@ if is_macos or os.getenv("FORCE_MACOS_MACHINE", "0") == "1":
"-Wno-newline-eof",
# required w/Xcode 5.1+ and above because of '-mno-fused-madd'
"-Wno-error=unused-command-line-argument",
+ "-mmacosx-version-min=10.13",
],
),
]