From b8ff00fc6a1546dc0e01d33b3fe06615431bd1c5 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Fri, 25 Jul 2025 11:13:51 -0700 Subject: [PATCH] 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 --- .github/workflows/build-cibuildwheel.yml | 31 +++++++++++++++++++++++- pyproject.toml | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-cibuildwheel.yml b/.github/workflows/build-cibuildwheel.yml index 5ab4210..f5b369e 100644 --- a/.github/workflows/build-cibuildwheel.yml +++ b/.github/workflows/build-cibuildwheel.yml @@ -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: diff --git a/pyproject.toml b/pyproject.toml index 6755248..88a65f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]