Rust build fails
~/test/trustmark/rust$ cargo bench
Compiling trustmark v0.1.0 (/home/neal/test/trustmark/rust)
error: linking with `cc` failed: exit status: 1
[super long error message]
logits_processor.cc:(.text._ZNSt10_HashtableIiiSaIiENSt8__detail9_IdentityESt8equal_toIiESt4hashIiENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE9_M_rehashEmRKm[_ZNSt10_HashtableIiiSaIiENSt8__detail9_IdentityESt8equal_toIiESt4hashIiENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE9_M_rehashEmRKm]+0x107): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: /home/neal/test/trustmark/rust/target/release/deps/libort_sys-67043d96470b7a97.rlib(uni_dir_attn_lstm.cc.o): in function `onnxruntime::contrib::rnn::detail::UniDirectionalAttnLstm<float>::Compute(gsl::span<float const, 18446744073709551615ul> const&, gsl::span<int const, 18446744073709551615ul> const&, int, gsl::span<float const, 18446744073709551615ul> const&, gsl::span<float const, 18446744073709551615ul> const&, gsl::span<float, 18446744073709551615ul>&, gsl::span<float, 18446744073709551615ul>&, gsl::span<float, 18446744073709551615ul>&)':
uni_dir_attn_lstm.cc:(.text._ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE7ComputeERKN3gsl4spanIKfLm18446744073709551615EEERKNS6_IKiLm18446744073709551615EEEiSA_SA_RNS6_IfLm18446744073709551615EEESG_SG_[_ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE7ComputeERKN3gsl4spanIKfLm18446744073709551615EEERKNS6_IKiLm18446744073709551615EEEiSA_SA_RNS6_IfLm18446744073709551615EEESG_SG_]+0x1cd): undefined reference to `__libc_single_threaded'
/usr/bin/ld: uni_dir_attn_lstm.cc:(.text._ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE7ComputeERKN3gsl4spanIKfLm18446744073709551615EEERKNS6_IKiLm18446744073709551615EEEiSA_SA_RNS6_IfLm18446744073709551615EEESG_SG_[_ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE7ComputeERKN3gsl4spanIKfLm18446744073709551615EEERKNS6_IKiLm18446744073709551615EEEiSA_SA_RNS6_IfLm18446744073709551615EEESG_SG_]+0x20c): undefined reference to `__libc_single_threaded'
/usr/bin/ld: uni_dir_attn_lstm.cc:(.text._ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE7ComputeERKN3gsl4spanIKfLm18446744073709551615EEERKNS6_IKiLm18446744073709551615EEEiSA_SA_RNS6_IfLm18446744073709551615EEESG_SG_[_ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE7ComputeERKN3gsl4spanIKfLm18446744073709551615EEERKNS6_IKiLm18446744073709551615EEEiSA_SA_RNS6_IfLm18446744073709551615EEESG_SG_]+0x238): undefined reference to `__libc_single_threaded'
/usr/bin/ld: /home/neal/test/trustmark/rust/target/release/deps/libort_sys-67043d96470b7a97.rlib(uni_dir_attn_lstm.cc.o): in function `onnxruntime::contrib::rnn::detail::UniDirectionalAttnLstm<float>::AllocateBuffers()':
uni_dir_attn_lstm.cc:(.text._ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE15AllocateBuffersEv[_ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE15AllocateBuffersEv]+0x3d): undefined reference to `__libc_single_threaded'
/usr/bin/ld: uni_dir_attn_lstm.cc:(.text._ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE15AllocateBuffersEv[_ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE15AllocateBuffersEv]+0x7d): undefined reference to `__libc_single_threaded'
/usr/bin/ld: /home/neal/test/trustmark/rust/target/release/deps/libort_sys-67043d96470b7a97.rlib(uni_dir_attn_lstm.cc.o):uni_dir_attn_lstm.cc:(.text._ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE15AllocateBuffersEv[_ZN11onnxruntime7contrib3rnn6detail22UniDirectionalAttnLstmIfE15AllocateBuffersEv]+0xbe): more undefined references to `__libc_single_threaded' follow
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
error: could not compile `trustmark` (bench "encode") due to 1 previous error
Same failure happens with cargo run --release -p trustmark-cli -- -m ./models decode -i signed.jpg
Same error happens with cargo run --release -p trustmark-cli -- -m ./models encode -i ../images/ghost.png -o ../images/encoded.png
Keep in mind, cargo xtask fetch-models works properly.
Attached is the full log file. log.txt
Can you tell me a little bit more about your system? Looking at this part of the error in particular:
...undefined reference to `__libc_single_threaded'
I suspect you're on an older glibc. I built in a ubuntu:22.04 container successfully, but I reproduce your error in a ubuntu:20.04 container. If building in a container with a newer glibc is an option for you, then I think that will solve your problem. To check your version of glibc, you can run:
ldd --version | head -n1
This is probably not solvable; the dependency on a newer glibc is coming from the ONNX runtime. I'll add a note to the README that a newer glibc is required.