-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix 45345 #46592
Fix 45345 #46592
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR @o01eg! We'll check in now and again to make sure this gets reviewed soon. |
Changes seem fine, but I'd like to r? @alexcrichton since I'm not entirely familiar with what the flag is meant to do. |
src/bootstrap/config.rs
Outdated
@@ -416,6 +416,7 @@ impl Config { | |||
config.docdir = install.docdir.clone().map(PathBuf::from); | |||
config.bindir = install.bindir.clone().map(PathBuf::from); | |||
config.libdir = install.libdir.clone().map(PathBuf::from); | |||
config.libdir_relative = install.libdir.clone().map(PathBuf::from); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm so actually I think this may be an old vestige that just hasn't actually been removed. Could the libdir-relative
key get removed in favor of inferring it from libdir
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed libdir_relative
from Config
struct.
src/bootstrap/compile.rs
Outdated
@@ -500,7 +500,7 @@ impl Step for Rustc { | |||
|
|||
/// Same as `std_cargo`, but for libtest | |||
pub fn rustc_cargo(build: &Build, | |||
compiler: &Compiler, | |||
_compiler: &Compiler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this argument remains unused, could it be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I've added commit to remove unused argument.
src/bootstrap/doc.rs
Outdated
let compiler = if build.force_use_stage1(compiler, target) { | ||
dylib_path.push(builder.rustc_libdir(compiler)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm could you detail a bit why this (and the above one) is needed? Shouldn't the rpath configuration cover this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It builds with rpath disabled because with rpath enabled it ends up with long library path with ..
directories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm when you say "it" in "it builds with rpath disabled" what is that referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean Rust installation script which builds Rust from source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the rpath should be configured here and IIRC that's enabled by default, but are you disabling that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, its just change path to libdir but there need to be stage1 libdir to generate docs and stage2 libdir for rustdoc stage2 executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to set RUSTC_LIBDIR
to stage2 libdir but https://github.com/rust-lang/rust/blob/master/src/bootstrap/doc.rs#L445 use stage1 rustc so it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is better to send libdir for stage2 in environment variable RUSTDOC_LIBDIR
or so instead set it with add_lib_path
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure yeah adding RUSTDOC_LIBDIR
sounds good! I think it'd be best to reuse what's already in the shim executables instead of adding more paths here, but hopefully isn't too bad to add!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reimplemented this with RUSTDOC_LIBDIR
.
Rebased and removed unused data. |
Rebased. Introduce environment variable |
Looks like issue with |
Nice! Could the |
I did it when tried different solutions for library path issue and reject it because it needs additional optional argument for |
Do things break if the function is folded in? Functions like this are notoriously hard to get right because there's very little testing, so having the build system be as non-surprising as possible is often best for long-term maintenance. |
No, things don't break but I decided it is simple to add call to additional function in some places than add additional argument in all places. I could change a way if it looks better. |
Yeah if it's ok let's fold it in to reduce the amount of boilerplate at callsites. |
Ok, I've rewritten to additional argument. |
src/bootstrap/builder.rs
Outdated
@@ -437,7 +437,8 @@ impl<'a> Builder<'a> { | |||
compiler: Compiler, | |||
mode: Mode, | |||
target: Interned<String>, | |||
cmd: &str) -> Command { | |||
cmd: &str, | |||
rustdoc_libdir: Option<PathBuf>) -> Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm isn't this argument always builder.rustc_libdir(compiler);
basically? If so, could this avoid being passed as an argument and just be set internally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, compiler
here could be stage1 if Build::force_use_stage1
returns true but real launched compiler will be from stage2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed yeah but rustdoc doesn't work at all in stage 1, so I think this is always the stage2 version for rustdoc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so real stage2 rustdoc
binary is choosen with REAL_RUSTDOC
environment variable while all other parameters from stage1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er so my point is that this argument is a constant, it's always generated from a stage2 compiler. In that case we can just inline it here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to do it with
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
but it fails with error:
thread 'main' panicked at '
Cycle in build detected when adding Assemble { target_compiler: Compiler { stage: 2, host: "x86_64-unknown-linux-gnu" } }
Any
Any
Any
Any
Any
', bootstrap/builder.rs:673:17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, does the same error happen if you only set this env var when the command is "doc"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try it but it also required here https://github.com/o01eg/rust/blob/50a80028052a4ca4ad939e926032bce8ac4d3cdd/src/bootstrap/check.rs#L1178
Are there "test" command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure yeah, maybe set it for everything that's not "build"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it helped.
Looks like there's some outstanding questions for you, @alexcrichton ! |
Rebased. Generate |
@bors: r+ Thanks! |
📌 Commit 472f4e1 has been approved by |
⌛ Testing commit 472f4e1 with merge 58ecb4753c7dd25cc51cd630f25e2d5fe0b296a5... |
💔 Test failed - status-appveyor |
@bors retry |
Fix 45345 There is a fix for #45345 It re-introduces `CFG_LIBDIR_RELATIVE` which was broken when migration from `configure` script to `x.py`. Other commits fix errors which happen after rustbuild cleanups.
☀️ Test successful - status-appveyor, status-travis |
Could it be backported to beta due it closes |
I've nominated it, but personally I won't assign a high priority in backporting this since the bug is not |
@o01eg are you using this as part of some packaging scheme? Is it possible to simply apply the patch locally? |
We don't usually backport stable-to-stable regressions unless there is a strong need (just because everybackport adds risk). |
But it depends also on how recently the regression occurred. |
@nikomatsakis Yes, it parts of packaging scheme so it possible to make a patch to fix releases without this PR. |
Ok thanks for the info @o01eg! In that case I'm going to remove the beta nomination |
This re-introduces a `Config.libdir_relative` field, now derived from `libdir` and made relative to `prefix` if necessary. This fixes a regression from rust-lang#46592 when `--libdir` is given an absolute path. `Builder::sysroot_libdir` should always use a relative path so its callers don't clobber system locations, and `librustc` also asserts that `CFG_LIBDIR_RELATIVE` is really relative.
…ulacrum rustbuild: Restore Config.libdir_relative This re-introduces a `Config.libdir_relative` field, now derived from `libdir` and made relative to `prefix` if necessary. This fixes a regression from rust-lang#46592 when `--libdir` is given an absolute path. `Builder::sysroot_libdir` should always use a relative path so its callers don't clobber system locations, and `librustc` also asserts that `CFG_LIBDIR_RELATIVE` is really relative.
This re-introduces a `Config.libdir_relative` field, now derived from `libdir` and made relative to `prefix` if necessary. This fixes a regression from rust-lang#46592 when `--libdir` is given an absolute path. `Builder::sysroot_libdir` should always use a relative path so its callers don't clobber system locations, and `librustc` also asserts that `CFG_LIBDIR_RELATIVE` is really relative.
Is this already in Rust 1.24.1 or will it first appear in Rust 1.25? |
I believe this will appear in 1.25. |
There is a fix for #45345
It re-introduces
CFG_LIBDIR_RELATIVE
which was broken when migration fromconfigure
script tox.py
.Other commits fix errors which happen after rustbuild cleanups.