Closed chienguo closed 2 years ago
Thanks for the report! how are you using tcmalloc?
I just follow the steps from the tcmalloc trate doc like this
add this line in Cargo.toml
:
tcmalloc = { version = "0.3.0", features = ["bundled"] }
and in lib.rs
:
#[global_allocator]
static GLOBAL: tcmalloc::TCMalloc = tcmalloc::TCMalloc;
Thanks!
This is a little tricky to support. It looks like we can grab the linked_libs
and linked_paths
values from the build-script-executed
event, and add them accordingly to LD_LIBRARY_PATH
. However, we still need to check whether cargo test
adds them to all invocations or just the ones that transitively depend on (eg) tcmalloc.
I'm not going to work on this for the next 2-3 weeks at least, but if someone would like to, please go ahead!
{"reason":"build-script-executed","package_id":"tcmalloc-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)","linked_libs":["static=tcmalloc"],"linked_paths":["native=/home/rain/dev/tmp/tcmalloc-test/target/debug/build/tcmalloc-sys-367b2d4b4b14a39c/out/build/.libs"],"cfgs":[],"env":[],"out_dir":"/home/rain/dev/tmp/tcmalloc-test/target/debug/build/tcmalloc-sys-367b2d4b4b14a39c/out"}
I have a project not using tcmalloc (to my knowledge) which is also hitting this.
Here is the relevant section of my cargo.toml:
https://gist.github.com/chamons/131d4d223b7f89fd8c436a18895a7f3d
Here is my output:
Finished test [unoptimized + debuginfo] target(s) in 0.13s
Error:
0: error building test list
1: running ''PATH/target/debug/deps/integration-1e38b67d0761f368 --list --format terse'' failed
2: command ["PATH/target/debug/deps/integration-1e38b67d0761f368", "--list", "--format", "terse"] exited with code <signal 9>
Deleting integration-1e38b67d0761f368 and running test again seems to work around it, but it makes using nextest pretty unreliable as often as I'm hitting it.
Working on this now!
Fix for this will go out in the next release, some time this week.
I used tcmalloc in my one project, but when I tried to use nextest, it complained about cannot open shared object file:
but it works fine when i use
cargo test
. here is my environment information: