Closed TheButlah closed 2 years ago
Cargo version: cargo 1.63.0-nightly (38472bc19 2022-05-31) OS: Ubuntu 20.04.4 on Windows 11 via WSL2
The error is non-deterministic btw, If I cargo clean and then cargo test --all, sometimes it happens and sometimes it doesnt'
Interesting; I think I've managed to run, in the past, into similar things myself, so definitely something I have had on my radar:
I strongly suspect this is caused by having n Rust (r)lib
rary such as tp_client
also have the cdylib
and/or staticlib
crate-type
s. Starting with Rust 1.61.0, there are nightly
/ RUSTC_BOOTSTRAP=1
ways to get compilations to use the specific cdylib
/ staticlib
types, without having to touch the Cargo.toml
in the general case.
That is, you could tweak tp_client
as follows:
# Cargo.toml
[lib]
- crate-type = ["rlib", "cdylib", "staticlib"]
# To compile `tp_client` as a C lib:
RUSTC_BOOTSTRAP=1 \
cargo rustc --crate-type=staticlib # --release # or --crate-type=cdylib
Other than that, safer-ffi
can't really help more; this is a Cargo / Rust bug; feel free to report it there: https://github.com/rust-lang/cargo/issues (see also stuff such as https://github.com/rust-lang/rust/issues/82151)
I get some strange linker errors when compiling with
cargo test --all
:_cargo_test__output.txt
Then I run
cargo test --all
again and I get this:circle_game
is a crate that depends on thetp_client
crate which usessafer-ffi
.circle_game
does not usesafer-ffi
at all.