Anush008/fastembed-rs

V2 has linker error on macOS

AlienKevin opened this issue ยท 1 comments

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

  • OS:
macOS Sonoma 14.2.1
Apple M1 Max
  • Rust:
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.74.1 (a28077b28 2023-12-04)`

๐ŸŽ‰ This issue has been resolved in version 2.0.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€