Page MenuHomeFreeBSD

lang/rust-bootstrap: Cross-compile Rust bootstraps for all archs
Needs ReviewPublic

Authored by tobik on Sat, Jan 11, 9:09 AM.


Group Reviewers

Goals are:

  1. Putting the cost of building them on the FreeBSD project instead of volunteers
  2. Creating bootstraps for only supported releases instead of using whatever upstream builds them on (currently 10.3-RELEASE)
  3. Having the ability to easily patch them when it becomes necessary

Adding portmgr for approval of flavors.

Test Plan

Does lang/rust build with the new bootstraps?

amd64, i386: yes, tested by @tobik
aarch64: untested, only smoke tested by compiling devel/tokei with bootstrap on Raspberry Pi 3
armv7: yes, tested by (thanks!)
armv6: untested
powerpc64 elfv1: yes. tested on ref12-ppc64 by @tobik, also tested by @pkubaj
powerpc64 elfv2: yes, tested by @pkubaj (thanks!)

Diff Detail

rP FreeBSD ports repository
No Linters Available
No Unit Test Coverage
Build Status
Buildable 28754
Build 26764: arc lint + arc unit

Event Timeline

tobik created this revision.Sat, Jan 11, 9:09 AM
tobik updated this revision to Diff 66616.Sat, Jan 11, 9:09 AM
  • Remove empty dir...
tobik updated this revision to Diff 66617.Sat, Jan 11, 9:16 AM
  • Drop unused compiler-rt from distinfo
tobik updated this revision to Diff 66619.Sat, Jan 11, 9:20 AM
  • Rebase
pkubaj accepted this revision.Tue, Jan 14, 2:23 PM

Tested to build on both elfv1 and elfv2.

This revision is now accepted and ready to land.Tue, Jan 14, 2:23 PM
mikael accepted this revision.Tue, Jan 14, 2:35 PM

They finally fixed their cross-compile issue, I hope it won't break in the future.
It's ok on armv7, I'm afraid I won't have time to test on armv6 or aarch64 (but I see no reason it would break).

tobik edited the test plan for this revision. (Show Details)Thu, Jan 16, 9:20 AM
garga added a subscriber: garga.Thu, Jan 16, 1:32 PM
garga added a comment.Fri, Jan 17, 3:31 PM

I tried to build lang/rust on native aarch64 builder with this patch applied, under a 11.3-STABLE jail and got:

running: /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/build/aarch64-unknown-freebsd/stage0/bin/cargo build --manifest-path /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/src/bootstrap/Cargo.toml --verbose --frozen
/wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/build/aarch64-unknown-freebsd/stage0/bin/cargo: Undefined symbol "lstat@FBSD_1.5"
Traceback (most recent call last):
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/", line 11, in <module>
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/src/bootstrap/", line 909, in main
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/src/bootstrap/", line 880, in bootstrap
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/src/bootstrap/", line 675, in build_bootstrap
    run(args, env=env, verbose=self.verbose)
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/src/bootstrap/", line 141, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/build/aarch64-unknown-freebsd/stage0/bin/cargo build --manifest-path /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/src/bootstrap/Cargo.toml --verbose --frozen
*** Error code 1

Would it be possible to have a bootstrap compatible with FreeBSD 11?

Would it be possible to have a bootstrap compatible with FreeBSD 11?

You'll need to change _RUST_FBSD_VER_aarch64 to 11.3. Be aware that there are bugs in rtld on aarch64 11.3 (not sure if the bug is fixed in 11-stable), you'll need a from 12.1 or 12.stable (see bug for details)

tobik updated this revision to Diff 66963.Sat, Jan 18, 9:34 AM
  • aarch64: Target 11.3-RELEASE (bootstrap already updated but give it an hour to appear on mirrors)
  • Add COMPAT_FREEBSD11 canary to lang/rust-bootstrap too
This revision now requires review to proceed.Sat, Jan 18, 9:34 AM
tobik updated this revision to Diff 66964.Sat, Jan 18, 9:57 AM
  • Rebase