Skip to content
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

Linking failure with ort=2.0.0-rc.6 and onnxruntime=1.19.2 on Linux #299

Closed
ia0 opened this issue Oct 18, 2024 · 4 comments
Closed

Linking failure with ort=2.0.0-rc.6 and onnxruntime=1.19.2 on Linux #299

ia0 opened this issue Oct 18, 2024 · 4 comments

Comments

@ia0
Copy link
Contributor

ia0 commented Oct 18, 2024

Steps to reproduce:

cd /tmp
python3 -m venv venv
source venv/bin/activate
python3 -m pip install cmake
git clone --recursive https://github.com/Microsoft/onnxruntime.git
cd onnxruntime
git checkout v1.19.2
./build.sh --config=Release --parallel
cd ..
git clone https://github.com/google/magika.git
cd magika/rust/cli
ORT_LIB_LOCATION=/tmp/onnxruntime/build/Linux cargo build --release

Expected output: no linking error

Actual output:

error: linking with `cc` failed: exit status: 1
  |
  = note: [...]
  = note: rust-lld: error: undefined symbol: absl::log_internal::LogMessage::LogMessage(char const*, int, absl::LogSeverity)
          >>> referenced by simplify.cc
          >>>               simplify.cc.o:(re2::CoalesceWalker::ShortVisit(re2::Regexp*, re2::Regexp*)) in archive /tmp/magika/rust/target/release/deps/libort_sys-c5ad07999a77da92.rlib
          >>> referenced by regexp.cc
          >>>               regexp.cc.o:(re2::NumCapturesWalker::ShortVisit(re2::Regexp*, int)) in archive /tmp/magika/rust/target/release/deps/libort_sys-c5ad07999a77da92.rlib
          >>> referenced by tostring.cc
          >>>               tostring.cc.o:(re2::ToStringWalker::~ToStringWalker()) in archive /tmp/magika/rust/target/release/deps/libort_sys-c5ad07999a77da92.rlib
          >>> referenced 87 more times
[...]
          rust-lld: error: undefined symbol: absl::log_internal::LogMessage& absl::log_internal::LogMessage::operator<<<unsigned long, 0>(unsigned long const&)
          >>> referenced by re2.cc
          >>>               re2.cc.o:(re2::RE2::Match(std::basic_string_view<char, std::char_traits<char>>, unsigned long, unsigned long, re2::RE2::Anchor, std::basic_string_view<char, std::char_traits<char>>*, int) const (.cold)) in archive /tmp/magika/rust/target/release/deps/libort_sys-c5ad07999a77da92.rlib
          >>> referenced by re2.cc
          >>>               re2.cc.o:(re2::RE2::Match(std::basic_string_view<char, std::char_traits<char>>, unsigned long, unsigned long, re2::RE2::Anchor, std::basic_string_view<char, std::char_traits<char>>*, int) const (.cold)) in archive /tmp/magika/rust/target/release/deps/libort_sys-c5ad07999a77da92.rlib
          >>> referenced by re2.cc
          >>>               re2.cc.o:(re2::RE2::Match(std::basic_string_view<char, std::char_traits<char>>, unsigned long, unsigned long, re2::RE2::Anchor, std::basic_string_view<char, std::char_traits<char>>*, int) const (.cold)) in archive /tmp/magika/rust/target/release/deps/libort_sys-c5ad07999a77da92.rlib
          >>> referenced 4 more times
          collect2: error: ld returned 1 exit status
          

error: could not compile `magika-cli` (bin "magika") due to 1 previous error

Note that linking also fails with 1.19.0 but works with 1.18.2. However running the resulting binary fails with:

The requested API version [19] is not available, only API versions [1, 18] are supported in this build. Current ORT Version is: 1.18.2
thread 'main' panicked at [...]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.6/src/lib.rs:223:57:
Failed to initialize ORT API

For context, we are trying to create a manylinux binary using maturin. This means there is only glibc 2.28, which is why we build from source. However, it seems even that might not be enough because I still see undefined reference to __libc_single_threaded in this workflow run. [EDIT: I was actually building ONNX Runtime outside the container...]

@decahedron1
Copy link
Member

Could you try a [patch] to see if 4da5700 fixed the issue? If so, that commit will be in an rc.7 releasing today.

@ia0
Copy link
Contributor Author

ia0 commented Oct 18, 2024

Could you try a [patch] to see if 4da5700 fixed the issue? If so, that commit will be in an rc.7 releasing today.

It's fixing most of the errors. The remaining ones are:

  = note: rust-lld: error: undefined symbol: absl::debugging_internal::VDSOSupport::VDSOSupport()
          >>> referenced by symbolize.cc
          >>>               symbolize.cc.o:(absl::debugging_internal::(anonymous namespace)::Symbolizer::GetUncachedSymbol(void const*) (.constprop.0)) in archive /tmp/magika/rust/target/release/deps/libort_sys-56c3e117cb85f6eb.rlib
          
          rust-lld: error: undefined symbol: absl::debugging_internal::VDSOSupport::LookupSymbolByAddress(void const*, absl::debugging_internal::ElfMemImage::SymbolInfo*) const
          >>> referenced by symbolize.cc
          >>>               symbolize.cc.o:(absl::debugging_internal::(anonymous namespace)::Symbolizer::GetUncachedSymbol(void const*) (.constprop.0)) in archive /tmp/magika/rust/target/release/deps/libort_sys-56c3e117cb85f6eb.rlib
          collect2: error: ld returned 1 exit status

However, when using the latest main commit b19cff4 then it links correctly and runs correctly (probably fixed by c882c58). I'll try that in the manylinux container to see if I have remaining errors there.

@ia0
Copy link
Contributor Author

ia0 commented Oct 18, 2024

I confirm this also works when building inside a manylinux container (example run).

We can close the issue from my side. I'll just use 2.0.0-rc.7 once it's released.

@decahedron1
Copy link
Member

2.0.0-rc.7 released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants