Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with Clang 16 on Mac OS #49

Open
kostyaorkostya opened this issue Dec 1, 2024 · 0 comments
Open

Build fails with Clang 16 on Mac OS #49

kostyaorkostya opened this issue Dec 1, 2024 · 0 comments

Comments

@kostyaorkostya
Copy link

Hi,

Building with default flags fails on Mac OS 14.6 (23G80) with Clang 16:

$ pip install MacFSEvents

Collecting MacFSEvents
  Using cached MacFSEvents-0.8.4.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: MacFSEvents
  Building wheel for MacFSEvents (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for MacFSEvents (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      /private/var/folders/81/1h30ll5x0s3dpfzh3chmyny80000gn/T/pip-build-env-uxfzyrxi/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-14.6-arm64-cpython-313
      copying fsevents.py -> build/lib.macosx-14.6-arm64-cpython-313
      running build_ext
      building '_fsevents' extension
      creating build/temp.macosx-14.6-arm64-cpython-313
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -I/Users/kostya/.pyenv/versions/3.13.0/envs/py3nvim/include -I/Users/kostya/.pyenv/versions/3.13.0/include/python3.13 -c _fsevents.c -o build/temp.macosx-14.6-arm64-cpython-313/_fsevents.o
      _fsevents.c:97:11: error: call to undeclared function 'PyEval_ThreadsInitialized'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
         97 |     if (! PyEval_ThreadsInitialized()) {
            |           ^
      _fsevents.c:98:9: warning: 'PyEval_InitThreads' is deprecated [-Wdeprecated-declarations]
         98 |         PyEval_InitThreads();
            |         ^
      /Users/kostya/.pyenv/versions/3.13.0/include/python3.13/ceval.h:114:1: note: 'PyEval_InitThreads' has been explicitly marked deprecated here
        114 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
            | ^
      /Users/kostya/.pyenv/versions/3.13.0/include/python3.13/pyport.h:251:54: note: expanded from macro 'Py_DEPRECATED'
        251 | #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
            |                                                      ^
      _fsevents.c:194:5: warning: 'FSEventStreamScheduleWithRunLoop' is deprecated: first deprecated in macOS 13.0 - Use FSEventStreamSetDispatchQueue instead. [-Wdeprecated-declarations]
        194 |     FSEventStreamScheduleWithRunLoop(fsstream, loop, kCFRunLoopDefaultMode);
            |     ^
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:1154:1: note: 'FSEventStreamScheduleWithRunLoop' has been explicitly marked deprecated here
       1154 | FSEventStreamScheduleWithRunLoop(
            | ^
      2 warnings and 1 error 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 MacFSEvents
Failed to build MacFSEvents
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (MacFSEvents)
$ /usr/bin/clang --version
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ python -V
Python 3.13.0
$ pip -V      
pip 24.3.1 from ... (python 3.13)

Passing -Wno-implicit-function-declaration solves the issue:

$ CFLAGS='-Wno-implicit-function-declaration' pip install MacFSEvents
Collecting MacFSEvents
  Using cached MacFSEvents-0.8.4.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: MacFSEvents
  Building wheel for MacFSEvents (pyproject.toml) ... done
  Created wheel for MacFSEvents: filename=MacFSEvents-0.8.4-cp313-cp313-macosx_14_0_arm64.whl size=15804 sha256=dbca236412e6fd327734e827f8f75f15735f39c680f8ffc7bf0c06f8983db5db
  Stored in directory: /Users/kostya/Library/Caches/pip/wheels/f3/73/2a/f42bcc31a3f5b8c1e5abaf129886ab1844bc88249fc37cb68c
Successfully built MacFSEvents
Installing collected packages: MacFSEvents
Successfully installed MacFSEvents-0.8.4

I suspect that it's because of a breaking change in Clang 16:
https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant