Skip to content

Build failed on MacBook Pro M1 #580

Closed
@harisalam

Description

Updated:
Please follow this to build k-NN in M1 for now to unblock yourself. Better process should be implemented still.

OpenSearch 3.0.0 distribution for mac does not exist in the public url. You can lower the version of k-NN to 2.3.0 which will use OpenSearch 2.3.0 release. Or, you can build your own OpenSearch distribution and use it as follow.

  1. Fork the OpenSearch Repo into your github account.
  2. Checkout the OpenSearch Repo in your laptop using right github commands.
  3. Run the below commands, as provided in the repo.
    $> cd OpenSearch && ./gradlew assemble && ./gradlew localDistro
  4. You should see a opensearch-min-3.0.0-SNAPSHOT-darwin-x64.tar.gz file present in distribution/archives/darwin-tar/build/distributions/
  5. Build k-NN by passing the OpenSearch distribution path in $> ./gradlew <integTest/run> -PcustomDistributionUrl="<Full path to .tar.gz file you noted above>"

With default setting of Make file I was getting the following error:
clang: error: the clang compiler does not support '-march=native'
Then someone from the community also experience an issue with this and solution was provided by changing -march=native to -mcpu=apple-a14, but that landed me on another issue which is omp.h not found. After researching for quite a long time I found out this error is caused of clang incompatibility on apple-m1.

Task :buildJniLib FAILED
Consolidate compiler generated dependencies of target NonMetricSpaceLib
[ 88%] Built target NonMetricSpaceLib
Consolidate compiler generated dependencies of target opensearchknn_common
[ 94%] Built target opensearchknn_common
Consolidate compiler generated dependencies of target opensearchknn_nmslib
[100%] Built target opensearchknn_nmslib
[ 2%] Building CXX object external/faiss/faiss/CMakeFiles/faiss.dir/AutoTune.cpp.o
In file included from /Users/harisalam/Documents/k-NN/jni/external/faiss/faiss/AutoTune.cpp:34:
In file included from /Users/harisalam/Documents/k-NN/jni/external/faiss/faiss/IndexHNSW.h:14:
/Users/harisalam/Documents/k-NN/jni/external/faiss/faiss/impl/HNSW.h:16:10: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
make[3]: *** [external/faiss/faiss/CMakeFiles/faiss.dir/AutoTune.cpp.o] Error 1
make[2]: *** [external/faiss/faiss/CMakeFiles/faiss.dir/all] Error 2
make[1]: *** [CMakeFiles/opensearchknn_faiss.dir/rule] Error 2
make: *** [opensearchknn_faiss] Error 2

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':buildJniLib'.

Process 'command 'make'' finished with non-zero exit value 2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    macosquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions