-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
rustdoc beta linking trouble in MinGW #41607
Comments
I have MinGW and MSYS installed from the msys2.org (msys2.github.io) page. That is needed to build the copies of the GNU libraries GMP, MPFR and MPC in gmp-mpfr-sys. |
@tspiteri: what does |
The gcc version is
|
I've done some narrowing, and the problem is on nightly-2017-04-07-x86_64-pc-windows-gnu, but everything is fine on nightly-2017-04-06-x86_64-pc-windows-gnu. And the problem is only in the testing of inline docs. Other tests, as well as dependent applications, all run fine. Edit: And the same happens for the i686 toolchain on a 32-bit MSYS shell. Everything works fine on nightly-2017-04-06-i686-pc-windows-gnu, but the issue is there on nightly-2017-04-07-i686-pc-windows-gnu. |
I'm attaching a reduced test case. |
Ok thanks for testing @tspiteri! @vadimcn that range of nightlies notably includes #40805 which I suspect is causing problems here. After some investigation it seems that this is related to the switch to Essentially I believe these lines boil down to a regression. I'm not really sure what to do about this situation. We've gotten ourselves into quite the quagmire with MinGW and the compiler. @vadimcn do you have thoughts? |
Ok so drilling more into this regression:
I honestly don't know what to do about this regression. @tspiteri my best suggestion to you is to uninstall the Other than that though the only way I can see to fix this is to switch from |
Also cc @rust-lang/tools, there may be more opinions on this as well. |
About cross-compiling from
|
@tspiteri, does it link correctly if you declare a dependency on libpthread in gmp-mpfr-sys's build script? |
@vadimcn, your suggestion works, though I needed
and both Note that compiling |
Okay, so here's what I think is happening:
Since I've just compared an older nightly with latest and it looks like we've stopped emitting In any event, I think we need to decide who should be responsible for bringing in the libraries required by C/C++ dependencies linked to Rust programs. I think it is still our long-term plan to stop linking any gcc libraries to pure-Rust programs? As we get better in this respect, more and more IMO, the cleanest approach would be for the Thoughts? |
I just noticed that nightlies from My current build script workaround is this:
Edit: Attaching workaround: workaround-try.zip |
Yeah, the old tool mingw chain did not bundle libpthread, AFAIR. |
There short term solution might be too change rustc to always emit |
@tspiteri ah yes sorry, I forgot about that! Cargo indeed does not run doctests on "cross compiles", e.g. where the host is not the exact same as the target. @vadimcn yeah I'm not sure what the best solution is here. I think your diagnosis is indeed correct though! FWIW I think we pass So some ways forward:
I'm not really sure which is the best per-se. I agree that the "cleanest" is to update the I'm not really sure if the @tspiteri well in any case your crate can be fixed with these lines in the build script I believe:
|
Well, it does work with pure-Rust software. The more complex projects usually do end up with C components, but this is by no means universal.
As far as I'm concerned, the primary reason for pc-windows-gnu is to have a toolchain that does not depend on any 3-rd party software. See, for example, how pc-windows-msvc toolchain got borked by VS2017 changing its install directory structure. I'm trying to imagine living in a world where we've eliminated/re-written all our GCC dependencies. Would we still want to be providing to the linker runtime dependencies for C components? What about other languages? (Say, people got into habit of linking together Rust and Go components).
Yes, I think this is what we should ultimately do.
Yes, messy. This sort of thing is the reason C software usually has
Not very tidy, but it would work, right?
Possibly. But we need to make sure that these libs end up in the right spot on linker's command line. We want them after dependent C objects. AFAIK, right now such a dependency would get compiled before the dependent crates, and any cargo metadata it emits would precede the C objects, right?
Maybe, though this would mean that even pure-Rust programs become dependent on libpthread1.dll.
Seems even worse from maintenance perspective than hardcoding dependencies in the gcc crate.
There's probably other crates that are in the same boat.
Also possible, but that's just kicking bucket down the road. Relying on gcc to provide dependencies will make it harder later when we want to switch to direct invocation of |
@vadimcn would you be willing to work on the changes to the |
Sure I'll take a look. I hope we can get away with hardcoding default libs per-target, or some such. |
Looks like this will hit 1.18. |
@vadimcn any updates? |
AFAIR, we had a chat with @alexcrichton a little while back, and decided to let this be. |
@vadimcn did you want to open an issue for making the unwinder an isolated rlib (no external deps) and then tweaking our default inclusion of libraries? |
@alexcrichton: I did some experiments and unfortunately it isn't as easy as it seemed at first sight. I am still thinking about it :). |
I'm running into this with uchardet at the moment and the relevant flag ( |
Triage: given the discussion above, and that there hasn't been any other real comments on this issue (other than @mitsuhiko who seems to have fixed it), I'm going to give this a close. Thanks! |
I have a crate
rugflo
which depends on a crategmp-mpfr-sys
. Thegmp-mpfr-sys
crate includes three C libraries that are compiled during crate compilation. One of the C libraries apparently makes use of__emutls_get_address
, and therugflo
crate makes use of this library.If I run
the
#[test]
tests succeed, but the inline documentation tests fail. On stable, both#[test]
and inline documentation tests succeed. I'm including part of the error message below.This is on the beta-x86_64-pc-windows-gnu toolchain, with beta version 1.18.0-beta.1 (4dce672 2017-04-25).
The text was updated successfully, but these errors were encountered: