elixir-nx/ortex

Missing onnxruntime on Mac stops build

Opened this issue · 3 comments

After the upgrade to ort-2.0.0-rc.0 (d00092f), building on an Intel Mac results in:

== Compilation error in file lib/ortex/native.ex ==
** (File.CopyError) could not copy from "/Users/mwhitworth/personal/ortex/_build/dev/lib/ortex/priv/native/libonnxruntime.so" to "/Users/mwhitworth/personal/ortex/_build/dev/lib/ortex/priv/native/libonnxruntime.so.1.17.0": no such file or directory

It appears - even though copy-dylibs is a feature automatically set on ort now, that no such file exists in the directory

This might be fixed by one or more of the commits in #28

As a workaround, from 4352926 - adding:

"-C", "link-arg=-fapple-link-rtlib",

to the linker flags in native/.ortex/.cargo/config.toml, and commenting out Ortex.Util.copy_ort_libs ensures all tests pass

We've been tracking this in main, unfortunately it's caused by a change in how upstream ort downloads the libraries on build (as you noticed). We've decided to wait until ort has stabilized on their 2.0 API changes before making the necessary changes since there's been some thrash in the 2.0rc releases.

Long term, I think we'll bring libonnxruntime downloading into ortex (along with rustler precompiled binaries) to have more control over which versions are built and fetched.

I'll leave this ticket open until those changes are made, but anyone who comes across this issue (and needs features in ortex main) can follow the same steps you outlined here and from the #28.