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

cargo test incompatible with latest rustup #3394

Closed
alexcrichton opened this issue Dec 13, 2016 · 10 comments · Fixed by rust-lang/rustup#3178
Closed

cargo test incompatible with latest rustup #3394

alexcrichton opened this issue Dec 13, 2016 · 10 comments · Fixed by rust-lang/rustup#3178

Comments

@alexcrichton
Copy link
Member

The 0.7 release of rustup changed how PATH is managed, and now cargo test where cargo is actually a rustup proxy will no longer work for this project itself.

I believe this has to do with something related to binaries eventually being compiled against the standard library dynamically and then the standard library dll can't be found at runtime. This'll need to be fixed with PATH munging somewhere although I'm not quite sure where.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Dec 13, 2016
bors added a commit that referenced this issue Dec 13, 2016
Pin to an older version of rustup temporarily

cc #3394
@alexcrichton
Copy link
Member Author

cc @brson

Also I believe this was caused by rust-lang/rustup#812

@Diggsey
Copy link
Contributor

Diggsey commented Feb 2, 2017

I think this may be the same as rust-lang/rustup/issues/765

The solution may be different on linux, but on windows I would expect the build tool (in this case cargo) to copy any required dynamic libraries into the output folder.

This would solve the problem for not just cargo test, but for all projects dynamically linking to other crates. It would also make it clearer to the end-user that they need to distribute these additional DLLs with their program.

@retep998
Copy link
Member

retep998 commented Feb 2, 2017

@Diggsey But the output folder for cargo install is shared among all your toolchains, and your toolchains each have their own versions of the dlls.

@Diggsey
Copy link
Contributor

Diggsey commented Feb 2, 2017

@retep998 You also can't cargo install the same executable from different toolchains, do you have a reason to use anything other than a single "host" toolchain while cargo installing?

@retep998
Copy link
Member

retep998 commented Feb 2, 2017

@Diggsey Imagine someone who cargo installs several different binaries, but over a period of time, and uses nightly. Each binary would depend on different nightly dlls.

@Diggsey
Copy link
Contributor

Diggsey commented Feb 7, 2017

Regardless of what rustup does, I don't think we can ever really support that without significant work to store DLLs in a namespaced subdirectory - or until rust gets a stable ABI

@masaeedu
Copy link

@alexcrichton Wouldn't this be a rustup bug? If I cargo install a program from source, the resulting binary can't run without the appropriate toolchain DLLs on my PATH (see https://github.com/Manishearth/rust-clippy/issues/1422). What tool's responsibility is this?

PS: Apologies in advance if that doesn't make any sense; I'm on quite the adventure here trying to set up a Hello World project in VS Code

@Diggsey
Copy link
Contributor

Diggsey commented Feb 25, 2017

@masaeedu As @alexcrichton said, for cargo test specifically, there are a number of places this could be fixed, because cargo test is not expected to work without a copy of the toolchain used to compile the test binaries.

However, for cargo install, or just generally when dynamically linking, there is nothing that rustup can do, since it plays no role in that process.

@pravic
Copy link

pravic commented May 15, 2017

@retep998

Imagine someone who cargo installs several different binaries, but over a period of time, and uses nightly.

I think, it would be easier to update tools with the nightly together (or just use some time-frozen nightly version with bunch of tools) than to do nothing. Because currently all compiler-dependent tools are just broken.

bors added a commit to rust-lang/rustup that referenced this issue May 17, 2017
Add the rust lib dir (containing std-<hash>.dll) to the path on windows

I'm not sure if this is the right thing or not, but this fixes some of rust-lang/cargo#3394. My apologies if it undoes earlier path related fixes.

The dylib tests in the cargo testsuite work.
`cargo test` of a dylib crate works.
It does nothing for the `cargo install` case.

It adds sysroot/bin to the path on Windows which fixes finding libstd. A side effect of this is that rustc.exe is directly in the path although it is after CARGO_HOME/bin so the shim should be found first.

The behavior of prepend_path in case of a corrupt path is changed - it used to clobber the existing path with the new path, and now it will leave leave the existing path unchanged.

It leaves LD_LIBRARY_PATH set on Windows also as I believe it is used by MinGW.
@carols10cents
Copy link
Member

I believe this was fixed in #3996. Closing!

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

Successfully merging a pull request may close this issue.

6 participants