xd009642 / tarpaulin

A code coverage tool for Rust projects
https://crates.io/crates/cargo-tarpaulin
Apache License 2.0
2.5k stars 180 forks source link

fails to link with libtorch using torch-sys #902

Closed Miezhiko closed 2 years ago

Miezhiko commented 2 years ago

with torch-sys in cargo deps by default if torch is not installed system-wide cargo will build and install libtorch by itself somewhere to target/ and application if run with cargo run will find and link with it.

with cargo-tarpaulin library is not searched on those paths and it fails with missing libtorch

my example: https://github.com/Miezhiko/Amadeus/blob/mawa/.github/workflows/codecov.yml

xd009642 commented 2 years ago

Let me try and figure out how cargo test makes them visible to the tests, because if you run cargo test it links to it, but then if you take the generated test binary and run it afterwards it will fail with the linker issue unless the correct path is part of the LD_LIBRARY_PATH. And that's the issue tarpaulin is having

Miezhiko commented 2 years ago

yes, cargo somehow adds proper libs paths to -sys crates using bundled libs when you do cargo run or cargo test

xd009642 commented 2 years ago

I've got a PR branch for this, tested it on a small torch project and I'll check it on Amadeus later this evening https://github.com/xd009642/tarpaulin/pull/904

xd009642 commented 2 years ago

It worked on Amadeus, so I've merged the PR. I'll aim to do a release next week most likely, but until then if you install via the develop branch or if you use docker the next develop image to be pushed out will have the fix in :+1: