There is a bug in the gmake jobserver implmentation that can cause it do deadlock when it is configured to use pselect(), which it is on FreeBSD. The upstream fix is to make the jobserver pipe descriptor non-blocking. Unfortunately the jobserver implementation in rust was not updated for compatibility until version 1.23. With the patch to gmake to fix the deadlock problem, the rust bootstrap fails like this:
Compiling rls-data v0.12.0
Compiling syntax_pos v0.0.0 (file:///wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/src/libsyntax_pos)
error: failed to acquire jobserver token
Resource temporarily unavailable (os error 35)
thread 'main' panicked at 'command did not execute successfully: "/wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/build/x86_64-unknown-freebsd/stage0/bi
n/cargo" "build" "--target" "x86_64-unknown-freebsd" "--release" "--frozen" "--features" " jemalloc llvm" "--manifest-path" "/wrkdirs/usr/ports/lang/rust/w
ork/rustc-1.23.0-src/src/rustc/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101', src/bootstrap/compile.rs:882:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Traceback (most recent call last):
File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/x.py", line 20, in <module>
File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/src/bootstrap/bootstrap.py", line 758, in main
File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/src/bootstrap/bootstrap.py", line 749, in bootstrap
run(args, env=env, verbose=build.verbose)
File "/wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/src/bootstrap/bootstrap.py", line 148, in run
RuntimeError: failed to run: /wrkdirs/usr/ports/lang/rust/work/rustc-1.23.0-src/build/bootstrap/debug/bootstrap build --verbose --config ./config.toml --jo
*** Error code 1
I just update lang/rust to 1.24.0. It uses Rust 1.23.0 to bootstrap. Is it enough to fix the problem?
I don't know if it's related, but the upstream bootstraps for amd64 and i386 hang early in the compilation of Rust. This is the case for several versions. The current workaround is to create new bootstraps out of the existing FreeBSD packages. I don't know if it's the case for the aarch64 bootstrap because I cross-compile it on amd64 but I don't have a aarch64 poudriere host.
Yes, I was able to build the updated rust with the gmake jobserver bugfix patch.
Great! Should we close this PR?
Thank you for reporting the issue!