I'm working on a project in Rust on MacOS, with some additional C/Fortran dependencies. All my dependencies are installed in my Conda environment. Unfortunately, invoking cargo test
yields a runtime failure, because it is unable to find libfortran.3.dylib
:
$ cargo test
...
dyld: Library not loaded: @rpath/libgfortran.3.dylib
Referenced from: /Users/user1/my_project/...
Reason: image not found
...
Setting LD_LIBRARY_PATH
to point to the right place removes this issue:
$ LD_LIBRARY_PATH=$CONDA_PREFIX/lib cargo test
...
running 208 tests
test test1 .. ok
...
Is there a way to put that information in Cargo.toml
so I don't have to explicitly modify the environment?