Page MenuHomeFreeBSD

lang/rust: Update to 1.45.0
ClosedPublic

Authored by tobik on Jul 13 2020, 10:23 PM.

Details

Summary

Scheduled to be released on 2020-07-16. Commit planned for next week (2020-07-20) around the same time this review was opened.

https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1450-2020-07-16

Other port changes:

  • Bundled LLVM was updated to 10.0.1 so drop many patches (assuming it's fine on powerpc64 since devel/llvm10 does not have any patches for it either)
  • Switch LLVM build to Ninja for some minor build time improvements (do not expect wonders; it only saved like 5 minutes here)
Test Plan

11.3 i386: ok consumers: ok
12.1 amd64: ok consumers: ok
13.0 amd64: ok
13.0 i386: ok
ppc64 elfv1: ok
ppc64 elfv2: ok
13.0 aarch64: ok
13.0 armv7: ok

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

  • Use the right bootstraps
  • Remove bogus bsd.sites.mk change...
  • Unbreak Gecko and devel/racer

On ELFv2, I'm getting this while building Rust:
Caused by:

 process didn't exit successfully:
 `/wrkdirs/usr/ports/lang/rust/work/rustc-1.45.0-src/build/powerpc64-unknown-freebsd/stage1-rustc/release/build/rustc_ast-8754226dab3e4f9c/build-sc
 ript-build` (signal: 11, SIGSEGV: invalid memory reference)
 warning: build failed, waiting for other jobs to finish...
 error: build failed

- {F7009474, layout=link}
- {F7009473, layout=link}
  • Make tool selection explicit; clippy was not installed for some reason (same with recent rust-nightly)
  • Back out ninja from rust-bootstrap. It breaks at least the armv6 flavor.
pkubaj requested changes to this revision.Jul 14 2020, 1:51 PM
This revision now requires changes to proceed.Jul 14 2020, 1:51 PM

On ELFv2, I'm getting this while building Rust:
Caused by:

 process didn't exit successfully:
 `/wrkdirs/usr/ports/lang/rust/work/rustc-1.45.0-src/build/powerpc64-unknown-freebsd/stage1-rustc/release/build/rustc_ast-8754226dab3e4f9c/build-sc
 ript-build` (signal: 11, SIGSEGV: invalid memory reference)
 warning: build failed, waiting for other jobs to finish...
 error: build failed

- {F7009474, layout=link}
- {F7009473, layout=link}

Can you upload the full log? Is ELFv1 fine?

I don't know yet about ELFv1, I'm still compiling. I needed to fix libssh2 first (https://svnweb.freebsd.org/ports?view=revision&revision=542223).

ELFv1 built fine and I also built games/genact with it.

It could be another LLVM bug, I'll try GCC.

powerpc64-elfv2-rust-bootstrap failed to build near the end too (everything else was fine on 12.1 amd64 now):

  = note: ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical14query_response47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$53instantiate_nll_query_response_and_region_obligations17hf1525b1803e5ebddE+0x1540): relocation R_PPC64_REL24 out of range: 33566572 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical14query_response47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$53instantiate_nll_query_response_and_region_obligations17hf1525b1803e5ebddE+0x1554): relocation R_PPC64_REL24 out of range: 33565496 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical14query_response47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$53instantiate_nll_query_response_and_region_obligations17hf1525b1803e5ebddE+0x1580): relocation R_PPC64_REL24 out of range: 33567516 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical14query_response47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$53instantiate_nll_query_response_and_region_obligations17hf1525b1803e5ebddE+0x15B0): relocation R_PPC64_REL24 out of range: 33566388 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical14query_response47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$53instantiate_nll_query_response_and_region_obligations17hf1525b1803e5ebddE+0x15B8): relocation R_PPC64_REL24 out of range: 33566452 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical14query_response47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$53instantiate_nll_query_response_and_region_obligations17hf1525b1803e5ebddE+0x15C8): relocation R_PPC64_REL24 out of range: 33567300 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$47instantiate_canonical_with_fresh_inference_vars17h221db4fc39f8449eE+0x174): relocation R_PPC64_REL24 out of range: 33563144 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$47instantiate_canonical_with_fresh_inference_vars17h221db4fc39f8449eE+0x184): relocation R_PPC64_REL24 out of range: 33562240 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$47instantiate_canonical_with_fresh_inference_vars17h633752df9e9c45e4E+0x15C): relocation R_PPC64_REL24 out of range: 33562748 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN11rustc_infer5infer9canonical47_$LT$impl$u20$rustc_infer..infer..InferCtxt$GT$47instantiate_canonical_with_fresh_inference_vars17h633752df9e9c45e4E+0x16C): relocation R_PPC64_REL24 out of range: 33561844 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN12rustc_middle2ty16structural_impls9fold_list17h113f263427fcf358E+0x36C): relocation R_PPC64_REL24 out of range: 33557244 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN12rustc_middle2ty16structural_impls9fold_list17h255d1a48d24cb4c4E+0x36C): relocation R_PPC64_REL24 out of range: 33556324 is not in [-33554432, 33554431]
          ld: error: rustc_mir.3f4ccmef-cgu.15:(.text._ZN12rustc_middle2ty16structural_impls9fold_list17h2819262d2bc1809aE+0x38C): relocation R_PPC64_REL24 out of range: 33555372 is not in [-33554432, 33554431]
          cc: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

error: could not compile `rustc_driver`.


This is a log with build using GCC on ELFv2. For some reason, it looks like it actually builds for ELFv1:

/usr/local/bin/ld: /tmp/rustc8n1qtk/libbacktrace-0acb2165e85793bc.rlib(backtrace-0acb2165e85793bc.backtrace.a9w6tkav-cgu.12.rcgu.o): ABI version 1 is not compatible with ABI version 2 output

I'll investigate it further.

  • Mark powerpc64-elfv2-rust-bootstrap as broken on 12.1 due to what probably is a bug in lld 9. It links fine on 13.0 which is good enough.

From src/llvm-project/clang/lib/Basic/Targets/PPC.h:

387     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
388       resetDataLayout("e-m:e-i64:64-n32:64");
389       ABI = "elfv2";
390     } else {
391       resetDataLayout("E-m:e-i64:64-n32:64");
392       ABI = "elfv1";
393     }

So LLVM patches for setting elfv2 are still necessary. It only uses elfv2 on little endian systems.

So LLVM patches for setting elfv2 are still necessary. It only uses elfv2 on little endian systems.

I was thinking that we maybe could just set the ABI in the Rust target (see attached patch) instead?

I'll check that later. For now, I'm testing whether I can build with patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCTargetMachine.cpp restored and patch-src_llvm-project_clang_lib_Basic_Targets_PPC.h modified to (to fix patching):

--- src/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp.orig  2019-09-20 16:14:30 UTC
+++ src/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -209,6 +209,20 @@ static PPCTargetMachine::PPCABI computeTargetABI(const
   if (TT.isMacOSX())
     return PPCTargetMachine::PPC_ABI_UNKNOWN;

+  if (TT.isOSFreeBSD()) {
+    switch (TT.getArch()) {
+    case Triple::ppc64le:
+    case Triple::ppc64:
+      if (TT.getOSMajorVersion() >= 13)
+        return PPCTargetMachine::PPC_ABI_ELFv2;
+      else
+        return PPCTargetMachine::PPC_ABI_ELFv1;
+    case Triple::ppc:
+    default:
+      return PPCTargetMachine::PPC_ABI_UNKNOWN;
+    }
+  }
+
   switch (TT.getArch()) {
   case Triple::ppc64le:
     return PPCTargetMachine::PPC_ABI_ELFv2;
  • Unbreak powerpc64-elfv2-rust-bootstrap runtime by setting elfv2 ABI in the powerpc64-unknown-freebsd target spec directly
  • This also unbreaks the build of it again on 12.1 amd64

With my patch, rust built, but firefox failed to build because of:

     Running `CARGO=/usr/local/bin/cargo CARGO_MANIFEST_DIR=/wrkdirs/usr/ports/www/firefox/work/firefox-78.0.2/toolkit/library/rust CARGO_PKG_AUTHORS='nobody@mozilla.org' CARGO_PKG_DESCRIPTION='Rust code for libxul' CARGO_PKG_HOMEPAGE= CARGO_PKG_NAME=gkrust CARGO_PKG_REPOSITORY= CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/wrkdirs/usr/ports/www/firefox/work/.build/release/deps:/usr/local/lib' /usr/local/bin/rustc --crate-name gkrust toolkit/library/rust/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type staticlib --emit=dep-info,link -C opt-level=2 -C panic=abort -Cembed-bitcode=no -Clto --cfg 'feature="cubeb_pulse_rust"' --cfg 'feature="moz_places"' --cfg 'feature="new_cert_storage"' --cfg 'feature="quantum_render"' --cfg 'feature="webgpu"' --cfg 'feature="webrtc"' -C metadata=c857c0d91e9703a6 -C extra-filename=-c857c0d91e9703a6 --out-dir /wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/deps --target powerpc64-unknown-freebsd -C linker=/wrkdirs/usr/ports/www/firefox/work/firefox-78.0.2/build/cargo-linker -L dependency=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/deps -L dependency=/wrkdirs/usr/ports/www/firefox/work/.build/release/deps --extern gkrust_shared=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/deps/libgkrust_shared-47354843de8b962f.rlib --extern mozglue_static=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/deps/libmozglue_static-ff460055df6aac22.rlib --extern mozilla_central_workspace_hack=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/deps/libmozilla_central_workspace_hack-2eaa04450d83bd08.rlib -C opt-level=2 -C
force-frame-pointers=yes --cap-lints warn -C codegen-units=1 -L native=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/build/lmdb-rkv-sys-e06b0a0df80f4451/out -L native=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/build/mozglue-static-4f53ba3e10b4cd02/out -L native=/wrkdirs/usr/ports/www/firefox/work/.build/dist/bin -L native=/wrkdirs/usr/ports/www/firefox/work/.build/security/nss/lib/nss/nss_nss3 -L native=/wrkdirs/usr/ports/www/firefox/work/.build/security/nss/lib/ssl/ssl_ssl3 -L native=/wrkdirs/usr/ports/www/firefox/work/.build/config/external/nspr/pr -L native=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/build/swgl-d786d746ebc211f6/out -L native=/wrkdirs/usr/ports/www/firefox/work/.build/powerpc64-unknown-freebsd/release/build/libloading-cb6f41703cd50d11/out -L native=/usr/local/lib`
error: options `-C embed-bitcode=no` and `-C lto` are incompatible

error: could not compile `gkrust`.

I'm trying your patch, but I guess, in this case, it's firefox that needs patching.

Ok, looks like I was using some earlier patch that didn't have www/firefox/files/patch-bug1640982. Trying the newest one now.

rust and firefox build on elfv2 with the latest patch.

tobik edited the test plan for this revision. (Show Details)
tobik edited the test plan for this revision. (Show Details)
mikael edited the test plan for this revision. (Show Details)
mikael added a reviewer: mikael.
This revision was not accepted when it landed; it landed in state Needs Review.Jul 17 2020, 6:44 AM
Closed by commit rP542412: lang/rust: Update to 1.45.0 (authored by tobik). · Explain Why
This revision was automatically updated to reflect the committed changes.