Anush008 / fastembed-rs

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

Linker error on Windows #85

Closed ozaner closed 3 months ago

ozaner commented 3 months ago

I can't build the crate on Windows due to some linker error:

error: linking with `link.exe` failed: exit code: 1120
  |
  = note: ...A bunch of paths to .o files (see full output txt)...
  = note:    Creating library C:\Users\admin\Source Code\test-fastembed\target\debug\deps\test_fastembed.lib and object C:\Users\admin\Source Code\test-fastembed\target\debug\deps\test_fastembed.exp
          LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
          libort_sys-f49947a43b73606c.rlib(svmclassifier.obj) : error LNK2019: unresolved external symbol __std_max_element_f referenced in function "float * __cdecl std::__std_max_element<float>(float * const,float * const)" (??$__std_max_element@M@std@@YAPEAMQEAM0@Z)
          libort_sys-f49947a43b73606c.rlib(logits_processor.obj) : error LNK2001: unresolved external symbol __std_max_element_f
          libort_sys-f49947a43b73606c.rlib(beam_search_scorer.obj) : error LNK2001: unresolved external symbol __std_max_element_f
          libort_sys-f49947a43b73606c.rlib(bias_softmax_fusion.obj) : error LNK2019: unresolved external symbol __std_max_4i referenced in function "auto __cdecl std::__std_max<int const >(int const * const,int const * const)" (??$__std_max@$$CBH@std@@YA?A_PQEBH0@Z)
          libort_sys-f49947a43b73606c.rlib(PooledUploadHeap.obj) : error LNK2019: unresolved external symbol __std_max_8u referenced in function "auto __cdecl std::__std_max<unsigned __int64 const >(unsigned __int64 const * const,unsigned __int64 const * const)" (??$__std_max@$$CB_K@std@@YA?A_PQEB_K0@Z)
          libort_sys-f49947a43b73606c.rlib(DmlOperatorGather.obj) : error LNK2001: unresolved external symbol __std_max_8u
          libort_sys-f49947a43b73606c.rlib(DmlOperatorScatter.obj) : error LNK2001: unresolved external symbol __std_max_8u
          C:\Users\admin\Source Code\test-fastembed\target\debug\deps\test_fastembed.exe : fatal error LNK1120: 3 unresolved externals

Here is a full copy of error output: output.txt

Enabling or disabling the ort-download-binaries feature doesn't seem to help.

Anush008 commented 3 months ago

I've never seen this before. So unsure of any solutions. Our CI runners at #79 seems to build fine on Win.

Anush008 commented 3 months ago

cc @decahedron1

decahedron1 commented 3 months ago

@ozaner Do you have the latest version (17.10) of VS2022 installed? The prebuilt binaries are compiled with 17.10.35027.167, so I'd imagine anything older would cause these linking errors.

ozaner commented 3 months ago

Yep this was it, I was on 17.7. Updating fixed it. Thanks!

TACIXAT commented 2 days ago

Similar issue here, on 17.9. I see the onnxruntime path as /LIBPATH in the link command but no onnxruntime.lib getting linked. I'll see if the upgrade helps.