Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run compiletests on Mac when DYLD_LIBRARY_PATH is unset or empty #233

Closed
jorendorff opened this issue Feb 9, 2021 · 1 comment
Closed

Comments

@jorendorff
Copy link
Contributor

Two separate bugs here. Full output below, but in short:

Part of the problem here is that std::env::split_paths("") is not an empty sequence [], but has one empty element [""] (Playground example). So a workaround is needed for that.

$ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.03s
     Running target/debug/deps/image-2fef4cbf6d86ba78

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/runtests-d1b0a6cde5f3e413

running 1 test
test compile_test ... FAILED

failures:

---- compile_test stdout ----
thread 'compile_test' panicked at 'Cannot link to dependencies. Problem with env var 'DYLD_LIBRARY_PATH': NotPresent', /Users/jorendorff/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.5.0/src/common.rs:254:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    compile_test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test runtests'
$ DYLD_LIBRARY_PATH= cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.05s
     Running target/debug/deps/image-2fef4cbf6d86ba78

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/runtests-d1b0a6cde5f3e413

running 1 test

running 8 tests
test [compile-fail] asynchronous/future-not-send-dyn.rs ... FAILED
test [compile-fail] asynchronous/future-lifetime.rs ... FAILED
test [compile-fail] asynchronous/async-block-return-type.rs ... FAILED
test [compile-fail] asynchronous/future-not-send-rc.rs ... FAILED
test [compile-fail] asynchronous/async-fn-not-unpin.rs ... FAILED
test [compile-fail] asynchronous/wrong_mutex.rs ... FAILED
test [compile-fail] asynchronous/fake-read-to-string.rs ... FAILED
test [compile-fail] asynchronous/left-or-right.rs ... FAILED

failures:

failures:
    [compile-fail] asynchronous/async-block-return-type.rs
    [compile-fail] asynchronous/async-fn-not-unpin.rs
    [compile-fail] asynchronous/fake-read-to-string.rs
    [compile-fail] asynchronous/future-lifetime.rs
    [compile-fail] asynchronous/future-not-send-dyn.rs
    [compile-fail] asynchronous/future-not-send-rc.rs
    [compile-fail] asynchronous/left-or-right.rs
    [compile-fail] asynchronous/wrong_mutex.rs

test result: FAILED. 0 passed; 8 failed; 0 ignored; 0 measured; 0 filtered out

test compile_test ... FAILED

failures:

---- compile_test stdout ----

error: asynchronous/future-lifetime.rs:44: expected error not found: `host` does not live long enough

error: asynchronous/async-block-return-type.rs:48: expected note not found: consider giving `future` a type

error: 
error: asynchronous/future-lifetime.rs:44: expected error not found: `path` does not live long enough
asynchronous/async-block-return-type.rs:53: expected error not found: type annotations needed

error: 0 unexpected errors found, 2 expected errors not found
status: exit code: 1
command: "rustc" "asynchronous/future-lifetime.rs" "-L" "/var/folders/2f/vxcscyq11kg3439lb05pmj8c0000gn/T/" "--target=x86_64-apple-darwin" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/var/folders/2f/vxcscyq11kg3439lb05pmj8c0000gn/T/future-lifetime.stage-id" "-A" "unused" "--edition" "2018" "--extern" "image" "-L" "-L" "/var/folders/2f/vxcscyq11kg3439lb05pmj8c0000gn/T/future-lifetime.stage-id.aux"
...

Note the "-L" "-L" "/var/..." at the end of the rustc command. The first -L is added by Config::link_deps, because the environment variable is empty. If I do LD_LIBRARY_PATH=banana cargo test, tests run normally.

@Munksgaard
Copy link
Collaborator

Munksgaard commented Feb 9, 2021

Thank you for reporting this issue. I cannot promise that I, or anyone else, will fix it right away, but pull requests are most welcome 🙂

Manishearth added a commit that referenced this issue Mar 4, 2021
Handle missing or empty DYLD_LIBRARY_PATH on Mac. Fixes #233.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants