fix: disable Faiss Python bindings to avoid CMake Python finding issues
- Set FAISS_ENABLE_PYTHON to OFF since we use our own Cython bindings - This avoids the CMake Python finding issues in manylinux environments - Simplify CMakeLists.txt by removing unnecessary Python finding logic - Keep swig installation for other potential uses
This commit is contained in:
12
.github/workflows/build-cibuildwheel.yml
vendored
12
.github/workflows/build-cibuildwheel.yml
vendored
@@ -53,7 +53,7 @@ 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 python3-devel
|
||||
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3
|
||||
ln -sf /usr/bin/cmake3 /usr/bin/cmake
|
||||
|
||||
# Install numpy before building
|
||||
@@ -63,9 +63,7 @@ jobs:
|
||||
|
||||
CIBW_BEFORE_BUILD_LINUX: |
|
||||
pip install numpy
|
||||
pip install --upgrade pip setuptools wheel
|
||||
# 确保Python开发文件可用
|
||||
python -m pip install --force-reinstall numpy
|
||||
pip install --upgrade pip setuptools wheel swig
|
||||
|
||||
CIBW_BEFORE_ALL_MACOS: |
|
||||
brew install boost zeromq openblas cmake libomp
|
||||
@@ -98,7 +96,7 @@ jobs:
|
||||
|
||||
CIBW_BEFORE_ALL_LINUX: |
|
||||
yum install -y epel-release
|
||||
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3 python3-devel
|
||||
yum install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake3
|
||||
ln -sf /usr/bin/cmake3 /usr/bin/cmake
|
||||
|
||||
# Install numpy before building
|
||||
@@ -108,9 +106,7 @@ jobs:
|
||||
|
||||
CIBW_BEFORE_BUILD_LINUX: |
|
||||
pip install numpy
|
||||
pip install --upgrade pip setuptools wheel
|
||||
# 确保Python开发文件可用
|
||||
python -m pip install --force-reinstall numpy
|
||||
pip install --upgrade pip setuptools wheel swig
|
||||
|
||||
CIBW_BEFORE_ALL_MACOS: |
|
||||
brew install boost zeromq openblas cmake libomp
|
||||
|
||||
@@ -24,25 +24,14 @@ set(MSGPACK_USE_BOOST OFF CACHE BOOL "" FORCE)
|
||||
add_compile_definitions(MSGPACK_NO_BOOST)
|
||||
include_directories(third_party/msgpack-c/include)
|
||||
|
||||
# Find Python before configuring Faiss
|
||||
# Check if we're in scikit-build environment
|
||||
# Find Python for our own use (not for Faiss)
|
||||
if(DEFINED SKBUILD)
|
||||
message(STATUS "Building with scikit-build, using provided Python")
|
||||
# scikit-build-core provides Python_* variables
|
||||
else()
|
||||
find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
|
||||
message(STATUS "Building with scikit-build")
|
||||
# scikit-build-core provides Python information
|
||||
endif()
|
||||
|
||||
# Print Python information for debugging
|
||||
message(STATUS "Python_FOUND: ${Python_FOUND}")
|
||||
message(STATUS "Python_VERSION: ${Python_VERSION}")
|
||||
message(STATUS "Python_EXECUTABLE: ${Python_EXECUTABLE}")
|
||||
message(STATUS "Python_INCLUDE_DIRS: ${Python_INCLUDE_DIRS}")
|
||||
message(STATUS "Python_LIBRARIES: ${Python_LIBRARIES}")
|
||||
message(STATUS "Python_NumPy_INCLUDE_DIRS: ${Python_NumPy_INCLUDE_DIRS}")
|
||||
|
||||
# Faiss configuration - streamlined build
|
||||
set(FAISS_ENABLE_PYTHON ON CACHE BOOL "" FORCE)
|
||||
set(FAISS_ENABLE_PYTHON OFF CACHE BOOL "" FORCE)
|
||||
set(FAISS_ENABLE_GPU OFF CACHE BOOL "" FORCE)
|
||||
set(FAISS_ENABLE_EXTRAS OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||
|
||||
@@ -21,6 +21,8 @@ sdist.include = ["CMakeLists.txt", "src", "third_party", "leann_backend_hnsw/*.t
|
||||
cmake.args = ["-DCMAKE_BUILD_TYPE=Release"]
|
||||
# 确保 CMake 可以找到系统库
|
||||
cmake.verbose = true
|
||||
build-dir = "build/{cache_tag}"
|
||||
minimum-version = "build-system.requires"
|
||||
|
||||
# CMake definitions to optimize compilation
|
||||
[tool.scikit-build.cmake.define]
|
||||
|
||||
@@ -84,6 +84,3 @@ before-all = "brew install boost zeromq openblas cmake libomp"
|
||||
# 环境变量配置
|
||||
[tool.cibuildwheel.environment]
|
||||
CMAKE_BUILD_PARALLEL_LEVEL = "8"
|
||||
|
||||
# 构建前安装必要的Python包
|
||||
before-build = "pip install numpy"
|
||||
|
||||
Reference in New Issue
Block a user