tomaka / shared_library

Apache License 2.0
19 stars 15 forks source link

Test failure on aarch64 and ppc64le #17

Open eclipseo opened 5 years ago

eclipseo commented 5 years ago

With Rust 1.33 on aarch64 and ppc64le:

running 2 tests
test dynamic_library::test::test_errors_do_not_crash ... ok
test dynamic_library::test::test_loading_cosine ... FAILED
failures:
---- dynamic_library::test::test_loading_cosine stdout ----
thread 'dynamic_library::test::test_loading_cosine' panicked at 'Could not load function cos: /builddir/build/BUILD/shared_library-0.1.9/target/release/deps/shared_library-bc52777775e47eb9: undefined symbol: cos', src/dynamic_library.rs:178:31
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
failures:
    dynamic_library::test::test_loading_cosine
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

All other arches work fine.

decathorpe commented 3 months ago

This test also appears to fail on RISC-V (riscv64gc-unknown-linux-gnu, I think).

aurel32 commented 3 months ago

This test also appears to fail on RISC-V (riscv64gc-unknown-linux-gnu, I think).

I can confirm that, here is a build log in debian: https://buildd.debian.org/status/fetch.php?pkg=rust-shared-library&arch=riscv64&ver=0.1.9-2%2Bb1&stamp=1713717273&raw=0

aurel32 commented 3 months ago

The problem seems to be that the assumption that "The math library does not need to be loaded since it is already statically linked in" is wrong. Loading libm.so here instead fixes the test issue.

See https://github.com/tomaka/shared_library/blob/f09e038246a559650c8505b3b3831b820d1a5689/src/dynamic_library.rs#L169