From 17d321cd11a938ac3eaeeded12969d6b83f9aa26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Sat, 3 Jun 2023 16:19:09 +0000 Subject: [PATCH 1/5] rust-lld: add rpath to the root LLVM shared lib rust-lld is not located in the same directory as the other binaries that point to ../lib, but in a deeper directory in lib. So we need to point a few layers up for rust-lld to find the LLVM shared library without rustup's LD_LIBRARY_PATH overrides. --- src/bootstrap/llvm.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/bootstrap/llvm.rs b/src/bootstrap/llvm.rs index 3fd0cca40e5..ab7906d0383 100644 --- a/src/bootstrap/llvm.rs +++ b/src/bootstrap/llvm.rs @@ -834,6 +834,30 @@ impl Step for Lld { } } + // LLD is built as an LLVM tool, but is distributed outside of the `llvm-tools` component, + // which impacts where it expects to find LLVM's shared library. This causes #80703. + // + // LLD is distributed at "$root/lib/rustlib/$host/bin/rust-lld", but the `libLLVM-*.so` it + // needs is distributed at "$root/lib". The default rpath of "$ORIGIN/../lib" points at the + // lib path for LLVM tools, not the one for rust binaries. + // + // (The `llvm-tools` component copies the .so there for the other tools, and with that + // component installed, one can successfully invoke `rust-lld` directly without rustup's + // `LD_LIBRARY_PATH` overrides) + // + if builder.config.rust_rpath + && builder.config.llvm_link_shared() + && target.contains("linux") + { + // So we inform LLD where it can find LLVM's libraries by adding an rpath entry to the + // expected parent `lib` directory. + // + // Be careful when changing this path, we need to ensure it's quoted or escaped: + // `$ORIGIN` would otherwise be expanded when the `LdFlags` are passed verbatim to + // cmake. + ldflags.push_all("-Wl,-rpath,'$ORIGIN/../../../'"); + } + configure_cmake(builder, target, &mut cfg, true, ldflags, &[]); configure_llvm(builder, target, &mut cfg); From 4117b5e65bdcace7df94fe28a621f252d4a9412d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Sat, 3 Jun 2023 19:50:45 +0000 Subject: [PATCH 2/5] improve target selection conditions --- src/bootstrap/llvm.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/llvm.rs b/src/bootstrap/llvm.rs index ab7906d0383..19e595650cf 100644 --- a/src/bootstrap/llvm.rs +++ b/src/bootstrap/llvm.rs @@ -845,7 +845,8 @@ impl Step for Lld { // component installed, one can successfully invoke `rust-lld` directly without rustup's // `LD_LIBRARY_PATH` overrides) // - if builder.config.rust_rpath + if builder.config.rpath_enabled(target) + && util::use_host_linker(target) && builder.config.llvm_link_shared() && target.contains("linux") { From 100db9946b69ddebb7925f0a57ee5a944b239030 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 4 Jun 2023 15:50:42 +0200 Subject: [PATCH 3/5] Update browser-ui-test version --- .../docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version index 3ccca1e8b89..413b31282f7 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version @@ -1 +1 @@ -0.16.5 \ No newline at end of file +0.16.6 \ No newline at end of file From d67e00eb2660614354f8016f6311cdc17ec7ae44 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 4 Jun 2023 15:55:30 +0200 Subject: [PATCH 4/5] Migrate GUI colors test to original CSS color format --- tests/rustdoc-gui/sidebar-mobile.goml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml index 3b022c7e9d0..4b8337ace3a 100644 --- a/tests/rustdoc-gui/sidebar-mobile.goml +++ b/tests/rustdoc-gui/sidebar-mobile.goml @@ -73,16 +73,16 @@ define-function: ( call-function: ("check-colors", { "theme": "ayu", - "color": "rgb(197, 197, 197)", - "background": "rgb(20, 25, 31)", + "color": "#c5c5c5", + "background": "#14191f", }) call-function: ("check-colors", { "theme": "dark", - "color": "rgb(221, 221, 221)", - "background": "rgb(80, 80, 80)", + "color": "#ddd", + "background": "#505050", }) call-function: ("check-colors", { "theme": "light", - "color": "rgb(0, 0, 0)", - "background": "rgb(245, 245, 245)", + "color": "black", + "background": "#F5F5F5", }) From f9a81e476992b8c1a7e9b67cf8a943a0ff03b978 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 4 Jun 2023 09:13:54 -0500 Subject: [PATCH 5/5] Don't require the output from libtest to be valid UTF-8 On Windows this is sometimes not the case, for reasons I can't track down. This works around the problem, although I'm not sure how to confirm we're not generating invalid build metrics in this case. --- src/bootstrap/render_tests.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/render_tests.rs b/src/bootstrap/render_tests.rs index 872b75f6c15..06ab820953d 100644 --- a/src/bootstrap/render_tests.rs +++ b/src/bootstrap/render_tests.rs @@ -88,10 +88,10 @@ impl<'a> Renderer<'a> { } fn render_all(mut self) { - let mut line = String::new(); + let mut line = Vec::new(); loop { line.clear(); - match self.stdout.read_line(&mut line) { + match self.stdout.read_until(b'\n', &mut line) { Ok(_) => {} Err(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break, Err(err) => panic!("failed to read output of test runner: {err}"), @@ -100,12 +100,13 @@ impl<'a> Renderer<'a> { break; } - match serde_json::from_str(&line) { + match serde_json::from_slice(&line) { Ok(parsed) => self.render_message(parsed), Err(_err) => { // Handle non-JSON output, for example when --nocapture is passed. - print!("{line}"); - let _ = std::io::stdout().flush(); + let mut stdout = std::io::stdout(); + stdout.write_all(&line).unwrap(); + let _ = stdout.flush(); } } }