Skip to content

Commit

Permalink
Fix build CI failure for MacOS
Browse files Browse the repository at this point in the history
Signed-off-by: Junqiu Lei <[email protected]>
  • Loading branch information
junqiu-lei committed May 3, 2024
1 parent fe91a0f commit 19dabe6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,31 +92,36 @@ jobs:
with:
java-version: ${{ matrix.java }}

- name: Install dependencies on macos
- name: Build native libraries
run: |
git submodule update --init --recursive
brew reinstall gcc
brew install llvm
brew install openblas
export FC=/opt/homebrew/bin/gfortran
export PATH=/opt/homebrew/opt/llvm/bin:$PATH
export CC=/opt/homebrew/opt/llvm/bin/clang
export CXX=/opt/homebrew/opt/llvm/bin/clang++
- name: Build native libraries
run: |
git submodule update --init --recursive
cd jni
sed -i -e 's/\/usr\/local\/opt\/libomp\//\/opt\/homebrew\/opt\/llvm\//g' cmake/init-faiss.cmake
sed -i -e 's/__aarch64__/__undefine_aarch64__/g' external/faiss/faiss/utils/distances_simd.cpp
sed -i -e 's/pragma message WARN/pragma message /g' external/nmslib/similarity_search/src/distcomp_scalar.cc
sed -i -e 's/-march=native/-mcpu=apple-m1/g' external/nmslib/similarity_search/CMakeLists.txt
sed -i -e 's/-mcpu=apple-a14/-mcpu=apple-m1/g' external/nmslib/python_bindings/setup.py
if sysctl -n machdep.cpu.features | grep -i AVX2;
then
echo "avx2 available on system"
cmake . --fresh
else
echo "avx2 not available on system"
cmake . --fresh -DSIMD_ENABLED=true
fi
cmake . --fresh
make
- name: Run build
run: |
if sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | grep -i AVX2
if sysctl -n machdep.cpu.features | grep -i AVX2;
then
echo "avx2 available on system"
./gradlew build
Expand Down Expand Up @@ -183,4 +188,3 @@ jobs:
- name: Run build
run: |
./gradlew.bat build -D'simd.enabled=false'

0 comments on commit 19dabe6

Please sign in to comment.