Skip to content

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

Closed

Description

@faern

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.

Activity

  1. alexcrichton commented on Feb 3, 2017

    @alexcrichton
    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!

  2. faern commented on Feb 3, 2017

    @faern
    ContributorAuthor

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

  3. retep998 commented on Feb 3, 2017

    @retep998
    Contributor
  4. alexcrichton commented on Feb 3, 2017

    @alexcrichton
    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)

  5. faern commented on Feb 4, 2017

    @faern
    ContributorAuthor

    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

  6. cjoecker commented on Jun 9, 2020

    @cjoecker

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions