Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot cmake on macOS 12.0.1 on M1 / osx-arm64 #2111

Closed
2 of 4 tasks
akgerber opened this issue Nov 16, 2021 · 6 comments
Closed
2 of 4 tasks

Cannot cmake on macOS 12.0.1 on M1 / osx-arm64 #2111

akgerber opened this issue Nov 16, 2021 · 6 comments
Labels

Comments

@akgerber
Copy link

akgerber commented Nov 16, 2021

Summary

I am attempting to follow the instructions to build Faiss in: https://github.com/facebookresearch/faiss/blob/main/INSTALL.md

I am unable to produce the Makefile via cmake:

>cmake -B build .
CMake Error at /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindOpenMP.cmake:544 (find_package_handle_standard_args)
  faiss/CMakeLists.txt:217 (find_package)


-- Configuring incomplete, errors occurred!

Platform

OS: macOS 12.0.1
Faiss version: b598f55
CMake version: 3.21.4, installed via Homebrew

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

>cmake -B build .
CMake Error at /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindOpenMP.cmake:544 (find_package_handle_standard_args)
  faiss/CMakeLists.txt:217 (find_package)


-- Configuring incomplete, errors occurred!

Note that I do have libopenmp installed:

 brew info libomp
libomp: stable 13.0.0 (bottled)
LLVM's OpenMP runtime library
https://openmp.llvm.org/
/opt/homebrew/Cellar/libomp/13.0.0 (9 files, 1.6MB) *
  Poured from bottle on 2021-11-16 at 15:12:49
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libomp.rb
License: MIT
==> Dependencies
Build: cmake ✔
==> Analytics
install: 102,098 (30 days), 295,521 (90 days), 1,169,984 (365 days)
install-on-request: 12,866 (30 days), 36,332 (90 days), 140,288 (365 days)
build-error: 1 (30 days)

An identical error occurs if I attempt to specify LLVM clang/clang++ (which support OpenMP):

 > CXX=/opt/homebrew/opt/llvm/bin/clang++ CC=/opt/homebrew/opt/llvm/bin/clang cmake -DFAISS_ENABLE_GPU=OFF -B build .
CMake Error at /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindOpenMP.cmake:544 (find_package_handle_standard_args)
  faiss/CMakeLists.txt:217 (find_package)

I am successfully able to use homebrew to build/install Faiss (but I would like to produce Python bindings which the Homebrew build does not appear to support):

> brew reinstall faiss --build-from-source
==> Downloading https://github.com/facebookresearch/faiss/archive/v1.7.1.tar.gz
==> Downloading from https://codeload.github.com/facebookresearch/faiss/tar.gz/v1.7.1
##O#-#
==> Reinstalling faiss
==> cmake -B build . -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_SHARED_LIBS=ON
==> make
==> make install
🍺  /opt/homebrew/Cellar/faiss/1.7.1: 101 files, 2.4MB, built in 10 seconds
@mdouze mdouze added the install label Nov 17, 2021
@beauby
Copy link
Contributor

beauby commented Nov 25, 2021

Could you provide the complete log of your cmake invocation?

@akgerber
Copy link
Author

akgerber commented Nov 29, 2021

Thanks for following up, @beauby !

I managed to get some help and worked around this by also specifying pointing the necessary library paths to LLVM clang paths, as well as turning off GPU support:

LDFLAGS="-L/opt/homebrew/opt/llvm/lib" CPPFLAGS="-I/opt/homebrew/opt/llvm/include" CXX=/opt/homebrew/opt/llvm/bin/clang++ CC=/opt/homebrew/opt/llvm/bin/clang cmake -DFAISS_ENABLE_GPU=OFF -B build .

Note LLVM clang can be installed with Homebrew via:

brew install llvm

@ceejatec
Copy link

Is it possible this will be corrected such that it does not require an extra compiler toolchain (LLVM) to be installed? Failing that, https://github.com/facebookresearch/faiss/blob/main/INSTALL.md should likely be updated with these instructions, if they are the 'official' approach.

@fdchiu
Copy link

fdchiu commented Nov 19, 2023

I am still having the same issue and the suggested solution does NOT work for me.

@shivam096
Copy link

Is there any update on this issue?

@nam178
Copy link

nam178 commented Mar 11, 2024

Installing openblas and libomp with brew then restart the terminal worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants