Bug 277220 - lang/rust: 1.76.0 build fails on aarch64
Summary: lang/rust: 1.76.0 build fails on aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Only Me
Assignee: FreeBSD Rust Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-22 08:16 UTC by Nuno Teixeira
Modified: 2024-03-25 13:02 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (rust)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno Teixeira freebsd_committer freebsd_triage 2024-02-22 08:16:36 UTC
Tested on current and 14.0-R (rpi4)_:

<...>

    rustc installed.

===========================================================================
=======================<phase: build          >============================
===== env: DEVELOPER_MODE=yes STRICT_DEPENDS=yes USER=root UID=0 GID=0
===>  Building for rust-1.76.0
Building bootstrap
running: /wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/cargo build --manifest-path /wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/src/bootstrap/Cargo.toml --verbose --verbose --frozen
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/rustc - --crate-name ___ --print=file-names -C linker=cc -Wrust_2018_idioms -Wunused_lifetimes --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  rustc -Cllvm-args="..." with: Unknown command line argument '-generate-arange-section'.  Try: 'rustc -Cllvm-args="..." with --help'
  rustc -Cllvm-args="..." with: Did you mean '--print-all-options'?
  rustc -Cllvm-args="..." with: Unknown command line argument '-mergefunc-use-aliases'.  Try: 'rustc -Cllvm-args="..." with --help'
  rustc -Cllvm-args="..." with: Did you mean '--rng-seed'?
  rustc -Cllvm-args="..." with: Unknown command line argument '-preserve-alignment-assumptions-during-inlining=false'.  Try: 'rustc -Cllvm-args="..." with --help'
  rustc -Cllvm-args="..." with: Did you mean '--print-all-options=false'?
  rustc -Cllvm-args="..." with: Unknown command line argument '-import-cold-multiplier=0.1'.  Try: 'rustc -Cllvm-args="..." with --help'
  rustc -Cllvm-args="..." with: Did you mean '--sort-timers=0.1'?
Traceback (most recent call last):
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/x.py", line 50, in <module>
    bootstrap.main()
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/src/bootstrap/bootstrap.py", line 1125, in main
    bootstrap(args)
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/src/bootstrap/bootstrap.py", line 1092, in bootstrap
    build.build_bootstrap()
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/src/bootstrap/bootstrap.py", line 880, in build_bootstrap
    run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
  File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/src/bootstrap/bootstrap.py", line 187, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/cargo build --manifest-path /wrkdirs/usr/ports/lang/rust/work/rustc-1.76.0-src/src/bootstrap/Cargo.toml --verbose --verbose --frozen
*** Error code 1

Logs:
https://people.freebsd.org/~eduardo/logs/rust-aarch64/15aarch64_rust-1.76.0.log
https://people.freebsd.org/~eduardo/logs/rust-aarch64/140aarch64_rust-1.76.0.log
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-22 08:19:33 UTC
(In reply to Nuno Teixeira from comment #0)
(...)

freebsd-arm list:
https://lists.freebsd.org/archives/freebsd-arm/2024-February/003770.html
Comment 2 Tatsuki Makino 2024-02-23 20:28:44 UTC
I don't have an ARM environment, so it's guesswork...
This seems to be provided with rustc binary included in distfile in a non-executable state.

The lang/rust port has the possibility to use another day's binary by the following definition.

BOOTSTRAPS_DATE_aarch64= 2023-12-27
RUST_BOOTSTRAP_VERSION_aarch64= nightly

Only nightly can be specified, since there does not seem to be a numeric version of the file on another day.
The following definitions are also useful when experimenting without updating distinfo.

NO_CHECKSUM=yes
DISABLE_SIZE=yes
Comment 3 Tatsuki Makino 2024-02-23 20:38:13 UTC
(In reply to Tatsuki Makino from comment #2)

The following combinations are present when examined by period :)

BOOTSTRAPS_DATE= 2024-02-08
RUST_BOOTSTRAP_VERSION= 1.76.0
Comment 4 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-23 21:07:28 UTC
(In reply to Tatsuki Makino from comment #3)

Following values matches WRKSRC/src/stage0.json:

# See WRKSRC/src/stage0.json for the date and version values
BOOTSTRAPS_DATE?=               2023-12-28
RUST_BOOTSTRAP_VERSION?=        1.75.0

Where did you check those values?

BOOTSTRAPS_DATE= 2024-02-08
RUST_BOOTSTRAP_VERSION= 1.76.0

Anyway I will give it a try :)
Comment 5 Tatsuki Makino 2024-02-24 03:25:08 UTC
(In reply to Nuno Teixeira from comment #4)

> Where did you check those values?

I used the values contained in the following commands and looked at them directly using a web browser :)

make -C /usr/ports/lang/rust/ -V _MASTER_SITES_ENV -V DISTFILES

How those values are connected is written in bsd.port.mk...
When we want other files in that directory, we scrape the filename from the address bar, don't we? :)

The dates used there in recent versions, 2023-10-05, 2023-11-16, and 2023-12-28, are all Thursdays.
Moreover, These intervals are multiples of 14, two weeks apart.
The rest is to be found by looking at cal -3 11 2023 and cal -3 2 2024 :)

I think this was the same cycle for Firefox.
I just feel that way. I don't know :)
Comment 6 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-24 10:27:52 UTC
(In reply to Tatsuki Makino from comment #5)

I did take a look at OpenBSD port:

# rustc bootstrap version
BV-aarch64 =            1.76.0-20240206
BV-amd64 =              1.76.0-20240205
BV-i386 =               1.76.0-20240205
BV-powerpc64 =          1.65.0-20221213
BV-riscv64 =            1.75.0-20240209
BV-sparc64 =            1.75.0p1-20240204

I can't do any further tests because I don't know how to build/get a new bootstrap different from what it is specified in out port.
Comment 7 Mikael Urankar freebsd_committer freebsd_triage 2024-02-24 10:33:04 UTC
It seems to work if the aarch64-rust-bootstrap is built with devel/freebsd-sysroot@a2022.12.14_1
Comment 8 Mikael Urankar freebsd_committer freebsd_triage 2024-02-24 10:42:47 UTC
It seems _SYSROOT_LLVM_TRIPLE_aarch64 was dropped in 7952ffc7c131f5420f83a1d3fffe0ee7d38a1cf3
I'll try to rebuild the freebsd-sysroot and rust-bootstrap with this line put back.
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2024-02-24 12:12:27 UTC
I confirm the bootstrap works with _SYSROOT_LLVM_TRIPLE_aarch64 put back in devel/freebsd-sysroot@a2023-12-30
Comment 10 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-24 12:40:39 UTC
(In reply to Mikael Urankar from comment #9)

Ok, something like was done in latest commit:

devel/freebsd-sysroot: put back custom triple for powerpc to fix rust-bootstrap
https://cgit.freebsd.org/ports/commit/?id=7a3359f95b32a7b29815923e2b2b2bc70be4348f

+_SYSROOT_LLVM_TRIPLE_aarch64= aarch64-unknown-freebsd13.2

is this correct?
Comment 11 commit-hook freebsd_committer freebsd_triage 2024-02-24 12:47:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a0802863390d880d8ea18de688162cad0e45f97e

commit a0802863390d880d8ea18de688162cad0e45f97e
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-02-24 12:46:56 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2024-02-24 12:46:56 +0000

    devel/freebsd-sysroot: put back custom triple for aarch64 to fix rust-bootstrap

    PR:             277220

 devel/freebsd-sysroot/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-02-24 13:08:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5f41aae86ef01a9fa542984d589ff07a2807ecde

commit 5f41aae86ef01a9fa542984d589ff07a2807ecde
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-02-24 13:07:29 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2024-02-24 13:07:29 +0000

    lang/rust: Update bootstrap for aarch64

    The previous one did not work.

    PR:             277220

 lang/rust/distinfo | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Comment 13 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-24 13:12:45 UTC
(In reply to commit-hook from comment #12)

===> Fetching all distfiles required by rust-1.76.0 for building
=> SHA256 Checksum OK for rust/rustc-1.76.0-src.tar.xz.
=> SHA256 Checksum mismatch for rust/2023-12-28/rustc-1.75.0-aarch64-unknown-freebsd.tar.xz.
=> SHA256 Checksum mismatch for rust/2023-12-28/rust-std-1.75.0-aarch64-unknown-freebsd.tar.xz.
=> SHA256 Checksum mismatch for rust/2023-12-28/cargo-1.75.0-aarch64-unknown-freebsd.tar.xz.
===>  Refetch for 1 more times files:  rust/2023-12-28/rustc-1.75.0-aarch64-unknown-freebsd.tar.xz  rust/2023-12-28/rust-std-1.75.0-aarch64-unknown-freebsd.tar.xz  rust/2023-12-28/cargo-1.75.0-aarch64-unknown-freebsd.tar.xz

Is a `make makesum` needed?
Comment 14 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-24 14:07:01 UTC
(In reply to Nuno Teixeira from comment #13)
(...)

Fixed and compiling.
Comment 15 Nuno Teixeira freebsd_committer freebsd_triage 2024-02-25 07:32:52 UTC
(In reply to Nuno Teixeira from comment #14)

Confirmed that rust builds fine and works as intended.
Thanks for quick fix!

Should we close this PR?
Comment 16 John Kennedy 2024-02-26 13:24:40 UTC
My RPI4 was too slow to hit the bleeding edge of this, but 1.76 compiled on it just fine (presumably after the fixes landed).