-
Notifications
You must be signed in to change notification settings - Fork 128
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
Update dev guide to fix clang linking issue on arm #1746
Update dev guide to fix clang linking issue on arm #1746
Conversation
Signed-off-by: Finn Roblin <[email protected]>
DEVELOPER_GUIDE.md
Outdated
export CC=/opt/homebrew/opt/llvm/bin/clang | ||
export CXX=/opt/homebrew/opt/llvm/bin/clang++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/opt/homebrew/opt/llvm/bin/clang
works for me. Can we keep both? you can add a note saying change to
in case of error: [Add the error] change to
export CC=gcc
export CXX=g++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure and let me ask Andrew what his error was -- I think they were different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pasting entire error trace here so that people can find it in search. Both of us had linking errors with clang:
<after running make>
77%] Building CXX object CMakeFiles/opensearchknn_faiss.dir/src/faiss_wrapper.cpp.o
[ 79%] Building CXX object CMakeFiles/opensearchknn_faiss.dir/src/faiss_util.cpp.o
<FAILS HERE> [ 79%] Linking CXX shared library release/libopensearchknn_faiss.jnilib
Here's the trace:
Homebrew clang version 18.1.7
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
"/usr/bin/ld" -demangle -lto_library /opt/homebrew/Cellar/llvm/18.1.7/lib/libLTO.dylib -dynamic -dylib -arch arm64 -dylib_install_name @rpath/libopensearchknn_faiss.jnilib -platform_version macos 14.0.0 14.4 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -mllvm -enable-linkonceodr-outlining -o release/libopensearchknn_faiss.jnilib -headerpad_max_install_names CMakeFiles/opensearchknn_faiss.dir/src/org_opensearch_knn_jni_FaissService.cpp.o CMakeFiles/opensearchknn_faiss.dir/src/faiss_wrapper.cpp.o CMakeFiles/opensearchknn_faiss.dir/src/faiss_util.cpp.o -rpath /Users/finnrobl/Code/k-NN/jni/release external/faiss/faiss/libfaiss.a release/libopensearchknn_util.jnilib -framework Accelerate -lm -ldl /opt/homebrew/opt/llvm/lib/libomp.dylib -lc++ -lSystem /opt/homebrew/Cellar/llvm/18.1.7/lib/clang/18/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture arm64:
"std::exception_ptr::__from_native_exception_pointer(void*)", referenced from:
std::__1::promise<bool>::~promise() in libfaiss.a[77](WorkerThread.cpp.o)
"___cxa_init_primary_exception", referenced from:
std::__1::promise<bool>::~promise() in libfaiss.a[77](WorkerThread.cpp.o)
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [release/libopensearchknn_faiss.jnilib] Error 1
make[1]: *** [CMakeFiles/opensearchknn_faiss.dir/all] Error 2
make: *** [all] Error 2
… linker error Signed-off-by: Finn Roblin <[email protected]>
@@ -452,4 +457,4 @@ The Github workflow in [`backport.yml`](.github/workflows/backport.yml) creates | |||
original PR with an appropriate label `backport <backport-branch-name>` is merged to main with the backport workflow | |||
run successfully on the PR. For example, if a PR on main needs to be backported to `1.x` branch, add a label | |||
`backport 1.x` to the PR and make sure the backport workflow runs on the PR along with other checks. Once this PR is | |||
merged to main, the workflow will create a backport PR to the `1.x` branch. | |||
merged to main, the workflow will create a backport PR to the `1.x` branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between these lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing intentional. I may have deleted a trailing whitespace but I'm not sure what triggered the diff.
Can you add a changelog entry? Otherwise looks good to me! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1746 +/- ##
============================================
- Coverage 85.09% 85.06% -0.04%
- Complexity 1473 1486 +13
============================================
Files 178 178
Lines 5937 6051 +114
Branches 607 632 +25
============================================
+ Hits 5052 5147 +95
- Misses 633 644 +11
- Partials 252 260 +8 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Finn Roblin <[email protected]>
…t#1746) * updated dev guide to fix clang linking issue on arm Signed-off-by: Finn Roblin <[email protected]> * restore clang instructions and add additional msg to use gcc if clang linker error Signed-off-by: Finn Roblin <[email protected]> * update changelog Signed-off-by: Finn Roblin <[email protected]> --------- Signed-off-by: Finn Roblin <[email protected]>
…t#1746) * updated dev guide to fix clang linking issue on arm Signed-off-by: Finn Roblin <[email protected]> * restore clang instructions and add additional msg to use gcc if clang linker error Signed-off-by: Finn Roblin <[email protected]> * update changelog Signed-off-by: Finn Roblin <[email protected]> --------- Signed-off-by: Finn Roblin <[email protected]>
…t#1746) * updated dev guide to fix clang linking issue on arm Signed-off-by: Finn Roblin <[email protected]> * restore clang instructions and add additional msg to use gcc if clang linker error Signed-off-by: Finn Roblin <[email protected]> * update changelog Signed-off-by: Finn Roblin <[email protected]> --------- Signed-off-by: Finn Roblin <[email protected]>
…t#1746) * updated dev guide to fix clang linking issue on arm Signed-off-by: Finn Roblin <[email protected]> * restore clang instructions and add additional msg to use gcc if clang linker error Signed-off-by: Finn Roblin <[email protected]> * update changelog Signed-off-by: Finn Roblin <[email protected]> --------- Signed-off-by: Finn Roblin <[email protected]>
Description
The current
DEVELOPER_GUIDE.md
M-series instructions did not work for me or @MrFlap. These updated instructions use gcc/g++ instead of clang to build and link the external kNN libraries. The project builds for me (m3 chip) and Andrew (m2 chip).Issues Resolved
Resolves linking issues with m-series macbook chips when building kNN locally.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.