Anush008 / fastembed-rs

Library for generating vector embeddings, reranking in Rust
https://docs.rs/fastembed
Apache License 2.0
264 stars 36 forks source link

V2 has linker error on macOS #17

Closed AlienKevin closed 9 months ago

AlienKevin commented 9 months ago

Issue

V1 worked like a charm but when I tried to recompile the code with V2, I immediately got the following linker error:

error: linking with `cc` failed: exit status: 1
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/Users/kevin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:

...

"-ladd_ort_library_path_or_enable_feature_download-binaries_see_ort_docs" "-lc++" "-framework" "Foundation" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/kevin/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Volumes/Documents/personal/wordshk-tools/examples/export_api/target/release/deps/export_api-368a468f1f948549" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: library 'add_ort_library_path_or_enable_feature_download-binaries_see_ort_docs' not found
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

The message add_ort_library_path_or_enable_feature_download-binaries_see_ort_docs suggests that I need to have either a custom ONNX build on path or enable the download-binaries feature, which is on by default. I checked the dependencies of fastembed and found that the default features are disabled, which explains why.

Workaround

The current workaround for me is to turn on the download-binaries feature by depending on ort directly in my code.

[dependencies.ort]
version = "2.0.0-alpha.4"
features = ["download-binaries"]

Proposal

I think maybe it makes sense for fastembed to keep some default features like download-binaries so that it can be built without issue on all desktops?

Environment

github-actions[bot] commented 9 months ago

:tada: This issue has been resolved in version 2.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: