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

Unable to run tests on dylib sub-crate in a workspace on Windows #39487

Closed
faern opened this issue Feb 3, 2017 · 6 comments
Closed

Unable to run tests on dylib sub-crate in a workspace on Windows #39487

faern opened this issue Feb 3, 2017 · 6 comments

Comments

@faern
Copy link
Contributor

faern commented Feb 3, 2017

I have a workspace set up where the root crate is a normal library crate and one of the sub-crates has crate-type dylib. In this setup the tests on the sub-crate can't be executed. Running the test exe (cargo test --all) exits with exit code:

-1073741515

Which converted becomes: 0xC0000135 = STATUS_DLL_NOT_FOUND

And I get a graphical error message stating:

The program can't start because test-83fa84e3d0f7a116.dll is missing
from your computer. Try reinstalling the program to fix this problem.

And then another dialog with the same message but test- replaced with std-. The crate must both be part of the workspace and have the crate-type dylib to trigger this problem.

I tried this code:

root/Cargo.toml:

[package]
name = "root"
version = "0.1.0"

[workspace]
members = ["dylib"]

root/dylib/Cargo.toml:

[package]
name = "dylib"
version = "0.1.0"

[lib]
crate-type = ["dylib"]

And then I run cargo test --all in the root crate or cargo test in the dylib crate.

Meta

Happens on both stable and nightly:
rustc 1.15.0 (10893a9a3 2017-01-19)
rustc 1.16.0-nightly (24055d0f2 2017-01-31)

Same problem on both x86_64-pc-windows-msvc and x86_64-pc-windows-gnu. Tried both on my own machine and in appveyor. Same result.

@alexcrichton
Copy link
Member

@faern do you have Rust installed through rustup? If so this looks like a familiar bug in rustup, but if not then sounds like something is awry!

@faern
Copy link
Contributor Author

faern commented Feb 3, 2017

@alexcrichton I have Rust installed through rustup, yes. I were not able to find a similar issue on github.

@retep998
Copy link
Member

retep998 commented Feb 3, 2017

rust-lang/rustup#893

@alexcrichton
Copy link
Member

Ok thanks for the confirmation @faern! In that case I'm going to close in favor of the upstream issue at rust-lang/rustup#893 (albeit somewhat oddly titled in relation to this issue)

@faern
Copy link
Contributor Author

faern commented Feb 4, 2017

Great. I'll follow that issue.

Just for anyone else who might stumble on this. Fixing this problem is pretty easy. Just add the bin folder of your toolchain to PATH. In appveyor I did it like this in my install section:

- set PATH=%PATH%;C:\Users\appveyor\.rustup\toolchains\%RUST_VERSION%-%TARGET%\bin

@cjoecker
Copy link

cjoecker commented Jun 9, 2020

This worked for me:

Just since this is somehow the top result on Google for "STATUS_DLL_NOT_FOUND cargo build". How to trace and solve any random occurence:

Download SysInternals procexp64.exe (or just every tool). After startup immediately hit the looking glass 'Stop capture' button (Ctrl+E). And 'Clear' (Ctrl+X).

Set filters for:

  • 'Process name' is 'build-script-build.exe' (or whatever the mentioned process name was) [Add]
  • 'Result' is not 'SUCCESS' [Add]
  • 'Path' ends with '.dll' [Add] [OK]

Start capture again (Ctrl+E).

Run build cargo again. Google for the last listed DLL file.

For me that was VCRUNTIM140.dll, so I installed the VC++ 2015 redistributable.

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

4 participants