fix: add missing dependencies for CI builds

- Add libomp for macOS to fix OpenMP linking error
- Add python3-devel for Linux (though may not be needed in manylinux)
- Install numpy before building to satisfy faiss CMake requirements
- Add before-build configuration to cibuildwheel
This commit is contained in:
Andy Lee
2025-07-25 10:20:02 -07:00
parent fb53ed9a0e
commit 0543cc9816
2 changed files with 33 additions and 6 deletions

View File

@@ -53,11 +53,15 @@ jobs:
# Linux dependencies - 使用yum因为manylinux2014基于CentOS 7
CIBW_BEFORE_ALL_LINUX: |
yum install -y epel-release
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3 python3-devel
ln -sf /usr/bin/cmake3 /usr/bin/cmake
# Install numpy before building
CIBW_BEFORE_BUILD: |
pip install numpy
CIBW_BEFORE_ALL_MACOS: |
brew install boost zeromq openblas cmake
brew install boost zeromq openblas cmake libomp
# Test the wheel
CIBW_TEST_COMMAND: |
@@ -68,6 +72,12 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL=8
Python_FIND_VIRTUALENV=ONLY
Python3_FIND_VIRTUALENV=ONLY
# Linux-specific environment variables
CIBW_ENVIRONMENT_LINUX: |
CMAKE_BUILD_PARALLEL_LEVEL=8
Python_FIND_VIRTUALENV=ONLY
Python3_FIND_VIRTUALENV=ONLY
- name: Build leann-backend-diskann wheels
uses: pypa/cibuildwheel@v2.20.0
@@ -83,11 +93,15 @@ jobs:
CIBW_BEFORE_ALL_LINUX: |
yum install -y epel-release
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3 python3-devel
ln -sf /usr/bin/cmake3 /usr/bin/cmake
# Install numpy before building
CIBW_BEFORE_BUILD: |
pip install numpy
CIBW_BEFORE_ALL_MACOS: |
brew install boost zeromq openblas cmake
brew install boost zeromq openblas cmake libomp
CIBW_TEST_COMMAND: |
python -c "import leann_backend_diskann; print('DiskANN backend imported successfully')"
@@ -96,6 +110,12 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL=8
Python_FIND_VIRTUALENV=ONLY
Python3_FIND_VIRTUALENV=ONLY
# Linux-specific environment variables
CIBW_ENVIRONMENT_LINUX: |
CMAKE_BUILD_PARALLEL_LEVEL=8
Python_FIND_VIRTUALENV=ONLY
Python3_FIND_VIRTUALENV=ONLY
- uses: actions/upload-artifact@v4
with:

View File

@@ -73,10 +73,17 @@ manylinux-aarch64-image = "manylinux2014"
[tool.cibuildwheel.linux]
before-all = """
yum install -y epel-release
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3 python3-devel
ln -sf /usr/bin/cmake3 /usr/bin/cmake
"""
# macOS系统依赖
[tool.cibuildwheel.macos]
before-all = "brew install boost zeromq openblas cmake"
before-all = "brew install boost zeromq openblas cmake libomp"
# 环境变量配置
[tool.cibuildwheel.environment]
CMAKE_BUILD_PARALLEL_LEVEL = "8"
# 构建前安装必要的Python包
before-build = "pip install numpy"