fix: address macOS deployment target and pyzmq compilation issues

- Set MACOSX_DEPLOYMENT_TARGET=11.0 for macOS builds
- Add pyzmq to test requirements to use pre-built wheels
- Configure deployment target in both workflow and pyproject.toml
- Skip ARM64 tests on GitHub Actions to avoid cross-compilation issues
This commit is contained in:
Andy Lee
2025-07-25 11:13:51 -07:00
parent 3c836766f8
commit b8ff00fc6a
2 changed files with 32 additions and 1 deletions

View File

@@ -68,10 +68,16 @@ jobs:
CIBW_BEFORE_ALL_MACOS: |
brew install boost zeromq openblas cmake libomp
# Test the wheel
# Test command to verify the wheel works
CIBW_TEST_COMMAND: |
python -c "import leann_backend_hnsw; print('HNSW backend imported successfully')"
# Skip problematic configurations
CIBW_TEST_SKIP: "*-macosx_arm64" # Skip ARM64 tests on GitHub Actions
# Test dependencies
CIBW_TEST_REQUIRES: "pytest numpy"
# Environment variables for build
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=8
@@ -81,6 +87,14 @@ jobs:
# Linux-specific environment variables
CIBW_ENVIRONMENT_LINUX: |
CMAKE_BUILD_PARALLEL_LEVEL=8
# macOS-specific environment variables
CIBW_ENVIRONMENT_MACOS: |
CMAKE_BUILD_PARALLEL_LEVEL=8
MACOSX_DEPLOYMENT_TARGET=11.0
CMAKE_OSX_DEPLOYMENT_TARGET=11.0
Python_FIND_VIRTUALENV=ONLY
Python3_FIND_VIRTUALENV=ONLY
- name: Build leann-backend-diskann wheels
uses: pypa/cibuildwheel@v2.20.0
@@ -111,9 +125,16 @@ jobs:
CIBW_BEFORE_ALL_MACOS: |
brew install boost zeromq openblas cmake libomp
# Test command to verify the wheel works
CIBW_TEST_COMMAND: |
python -c "import leann_backend_diskann; print('DiskANN backend imported successfully')"
# Skip problematic configurations
CIBW_TEST_SKIP: "*-macosx_arm64" # Skip ARM64 tests on GitHub Actions
# Test dependencies - install pre-built pyzmq to avoid compilation issues
CIBW_TEST_REQUIRES: "pytest numpy pyzmq"
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=8
Python_FIND_VIRTUALENV=ONLY
@@ -129,6 +150,14 @@ jobs:
Python3_FIND_STRATEGY=LOCATION
Python_EXECUTABLE=$VIRTUAL_ENV/bin/python
Python3_EXECUTABLE=$VIRTUAL_ENV/bin/python
# macOS-specific environment variables
CIBW_ENVIRONMENT_MACOS: |
CMAKE_BUILD_PARALLEL_LEVEL=8
MACOSX_DEPLOYMENT_TARGET=11.0
CMAKE_OSX_DEPLOYMENT_TARGET=11.0
Python_FIND_VIRTUALENV=ONLY
Python3_FIND_VIRTUALENV=ONLY
- uses: actions/upload-artifact@v4
with:

View File

@@ -80,6 +80,8 @@ before-all = """
# macOS系统依赖
[tool.cibuildwheel.macos]
before-all = "brew install boost zeromq openblas cmake libomp"
# 设置macOS最小版本
environment = { MACOSX_DEPLOYMENT_TARGET = "11.0", CMAKE_OSX_DEPLOYMENT_TARGET = "11.0" }
# 环境变量配置
[tool.cibuildwheel.environment]