summaryrefslogtreecommitdiff
path: root/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2021-11-30 13:54:55 +0100
committerTobias Kortkamp <tobik@FreeBSD.org>2021-12-05 13:35:41 +0100
commit237b36fa2e73986dc19284686e80a47cb329bb6f (patch)
treeabc3279705b006763706536c7330abed816a4690 /lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
parentx11/bemenu: Update to 0.6.4 (diff)
lang/rust: Update to 1.57.0
- Unbreak build with LibreSSL 3.4.x [0] - Disable backtrace's libunwind backend on armv* since it or libunwind in base seem to be buggy and cause rustc to crash when building some consumers [1] - Follow rust-nightly in d5f09dc31fcfdb77b69c86b9093bf67ec67653d9 and reenable hardlinks in the build Changes: https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html PR: 259738 [0] PR: 259799 [1] PR: 260140 Exp-run by: antoine Differential Revision: https://reviews.freebsd.org/D33190 With hat: rust
Diffstat (limited to 'lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs')
-rw-r--r--lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs b/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
new file mode 100644
index 000000000000..081c2056ad2c
--- /dev/null
+++ b/lang/rust/files/no-hardlinks/patch-src_bootstrap_lib.rs
@@ -0,0 +1,28 @@
+Attempt to fix intermittent "can't find crate for `std`" build failures
+
+The location of rustc (found via env::current_exe()) is used to
+find the right libstd. However it might have been "copied" by
+creating a hard link to the new location instead. Like /proc/curproc/file,
+KERN_PROC_PATHNAME (used internally by current_exe()) can return
+any of the file's multiple paths. Most of the time it returns the
+right rustc path and the build will succeed but occasionally it
+will return the "wrong" path and the build fails with:
+
+ error[E0463]: can't find crate for `std`
+
+If this is right a viable workaround should be to never create hard
+links during the build, so let's try that.
+
+--- src/bootstrap/lib.rs.orig 2020-07-23 20:16:43 UTC
++++ src/bootstrap/lib.rs
+@@ -1173,10 +1173,6 @@ impl Build {
+ if metadata.file_type().is_symlink() {
+ let link = t!(fs::read_link(src));
+ t!(symlink_file(link, dst));
+- } else if let Ok(()) = fs::hard_link(src, dst) {
+- // Attempt to "easy copy" by creating a hard link
+- // (symlinks don't work on windows), but if that fails
+- // just fall back to a slow `copy` operation.
+ } else {
+ if let Err(e) = fs::copy(src, dst) {
+ panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)