Skip to content

Build fails on macOS ARM64 with cerrno header not found #678

@Omer80

Description

@Omer80

Environment

  • OS: macOS (arm64)
  • Python version: 3.12
  • Annoy version: 1.17.3
  • Compiler: clang++

Issue Description

When trying to install annoy via pip, the build fails with a compilation error indicating that the cerrno header file cannot be found.

Steps to Reproduce

  1. Create a virtual environment
  2. Run pip install annoy==1.17.3

Error Output

Collecting annoy==1.17.3
Using cached annoy-1.17.3.tar.gz (647 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: annoy
Building wheel for annoy (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for annoy (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [output]
running bdist_wheel
running build
running build_py
creating build/lib.macosx-10.13-universal2-cpython-312/annoy
copying annoy/init.py -> build/lib.macosx-10.13-universal2-cpython-312/annoy
copying annoy/init.pyi -> build/lib.macosx-10.13-universal2-cpython-312/annoy
copying annoy/py.typed -> build/lib.macosx-10.13-universal2-cpython-312/annoy
running build_ext
building 'annoy.annoylib' extension
creating build/temp.macosx-10.13-universal2-cpython-312/src
clang++ -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/user/code/livekit-apps/livekit-rag-thinking/venv/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/annoymodule.cc -o build/temp.macosx-10.13-universal2-cpython-312/src/annoymodule.o -D_CRT_SECURE_NO_WARNINGS -fpermissive -O3 -ffast-math -fno-associative-math -DANNOYLIB_MULTITHREADED_BUILD -std=c++14 -mmacosx-version-min=10.12
In file included from src/annoymodule.cc:15:
src/annoylib.h:53:10: fatal error: 'cerrno' file not found
53 | #include <cerrno>
| ^~~~~~~~
1 error generated.
error: command '/usr/bin/clang++' failed with exit code 1

Additional Context

The error occurs during the compilation phase when trying to build the C++ extension. The compiler is unable to find the standard C++ header cerrno. This might be related to the macOS SDK path configuration or C++ standard library installation.

Possible Related Issues

  • This might be related to the minimum macOS version being set to 10.12 (-mmacosx-version-min=10.12) while building on a newer system
  • The universal2 build attempting both arm64 and x86_64 architectures might be contributing to the issue

Would appreciate any guidance on resolving this compilation error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions