Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uprustdoc beta linking trouble in MinGW #41607
Comments
alexcrichton
added
regression-from-stable-to-beta
T-tools
labels
Apr 28, 2017
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
@tspiteri: what does |
This comment has been minimized.
This comment has been minimized.
|
The gcc version is
|
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
I'm attaching a reduced test case. |
This comment has been minimized.
This comment has been minimized.
|
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? |
brson
assigned
alexcrichton
May 4, 2017
brson
added
P-medium
A-linkage
T-rustdoc
labels
May 4, 2017
alexcrichton
referenced this issue
May 5, 2017
Merged
[Windows] Enable building rustc with "pthreads" flavor of mingw. #40805
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
Also cc @rust-lang/tools, there may be more opinions on this as well. |
This comment has been minimized.
This comment has been minimized.
|
About cross-compiling from
|
This comment has been minimized.
This comment has been minimized.
|
@tspiteri, does it link correctly if you declare a dependency on libpthread in gmp-mpfr-sys's build script? |
This comment has been minimized.
This comment has been minimized.
|
@vadimcn, your suggestion works, though I needed
and both Note that compiling |
This comment has been minimized.
This comment has been minimized.
|
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? |
This comment has been minimized.
This comment has been minimized.
|
I just noticed that nightlies from My current build script workaround is this:
Edit: Attaching workaround: workaround-try.zip |
This comment has been minimized.
This comment has been minimized.
|
Yeah, the old tool mingw chain did not bundle libpthread, AFAIR. |
This comment has been minimized.
This comment has been minimized.
|
There short term solution might be too change rustc to always emit |
This comment has been minimized.
This comment has been minimized.
|
@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:
|
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
|
@vadimcn would you be willing to work on the changes to the |
This comment has been minimized.
This comment has been minimized.
|
Sure I'll take a look. I hope we can get away with hardcoding default libs per-target, or some such. |
steveklabnik
added
T-dev-tools
and removed
T-tools
labels
May 18, 2017
This comment has been minimized.
This comment has been minimized.
|
Looks like this will hit 1.18. |
brson
added
the
I-wrong
label
Jun 1, 2017
brson
added
regression-from-stable-to-stable
and removed
regression-from-stable-to-beta
labels
Jun 15, 2017
This comment has been minimized.
This comment has been minimized.
|
@vadimcn any updates? |
brson
assigned
vadimcn
and unassigned
alexcrichton
Jun 15, 2017
This comment has been minimized.
This comment has been minimized.
|
AFAIR, we had a chat with @alexcrichton a little while back, and decided to let this be. |
This comment has been minimized.
This comment has been minimized.
|
@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? |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton: I did some experiments and unfortunately it isn't as easy as it seemed at first sight. I am still thinking about it :). |
Mark-Simulacrum
added
C-bug
and removed
I-wrong
labels
Jul 27, 2017
This comment has been minimized.
This comment has been minimized.
|
I'm running into this with uchardet at the moment and the relevant flag ( |
tspiteri commentedApr 28, 2017
I have a crate
rugflowhich depends on a crategmp-mpfr-sys. Thegmp-mpfr-syscrate includes three C libraries that are compiled during crate compilation. One of the C libraries apparently makes use of__emutls_get_address, and therugflocrate 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).