Bug 235241

Summary: lang/rust does not build on amd64 12.0 (bootstrap is for wrong version)
Product: Ports & Packages Reporter: pr
Component: Individual Port(s)Assignee: FreeBSD Rust Team <rust>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: mikael.urankar, phascolarctos
Priority: --- Flags: tobik: maintainer-feedback+
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
rust-1.30 poudriere log on 12.0 RELEASE
none
rust-1.32.0 poudriere log none

Description pr 2019-01-27 11:53:47 UTC
lang/cargo does not build on 12.0 amd64. This is annoying since this prevents firefox from building.

How to reproduce:
cd /usr/ports/lang/rust && make

Output:
[...]
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/share/doc/cargo/LICENSE-APACHE
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/share/doc/cargo/LICENSE-MIT
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/share/doc/cargo/LICENSE-THIRD-PARTY
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/share/doc/cargo/README.md
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/manifest.in
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/etc/bash_completion.d/cargo
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/bin/cargo
  extracting cargo-0.32.0-x86_64-unknown-freebsd/cargo/share/zsh/site-functions/_cargo
running: /usr/ports/lang/rust/work/rustc-1.32.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo build --manifest-path /usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/Cargo.toml --frozen
Traceback (most recent call last):
  File "/usr/ports/lang/rust/work/rustc-1.32.0-src/x.py", line 20, in <module>
    bootstrap.main()
  File "/usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 853, in main  
    bootstrap(help_triggered)
  File "/usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 824, in bootstrap
    build.build_bootstrap()
  File "/usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 652, in build_bootstrap
    run(args, env=env, verbose=self.verbose)
  File "/usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 151, in run   
    raise RuntimeError(err)
RuntimeError: failed to run: /usr/ports/lang/rust/work/rustc-1.32.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo build --manifest-path /usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/Cargo.toml --frozen
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/lang/rust
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/rust


FACTS:

The error is not clear, so if you execute by hand the failing command you get some more info:
/usr/ports/lang/rust # /usr/ports/lang/rust/work/rustc-1.32.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo build --manifest-path /usr/ports/lang/rust/work/rustc-1.32.0-src/src/bootstrap/Cargo.toml --frozen
Bad system call (core dumped)

cargo bootstrap does not work, and with a reason: it's built for 10.3 when we are on 12.0 now, in fact:
:/usr/ports/lang/rust # file /usr/ports/lang/rust/work/rustc-1.32.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo
/usr/ports/lang/rust/work/rustc-1.32.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 10.3, FreeBSD-style, with debug_info, not stripped


SPECULATION:

Suggested action: either rebuild the bootstrap for 12.0 or have cargo be a port on its own that builds for the current OS version.
Comment 1 Tobias Kortkamp freebsd_committer 2019-01-27 12:13:54 UTC
Yeah, this is known.

> with a reason: it's built for 10.3 when we are on 12.0 now,

May I suggest that you just rebuilt your kernel with COMPAT_FREEBSD10 and
COMPAT_FREEBSD11 enabled?
Comment 2 mikael.urankar 2019-01-27 12:29:22 UTC
freebsd 10.x is eol, why do we rely on something built for 10.x?
Comment 3 pr 2019-01-29 11:23:41 UTC
(In reply to Tobias Kortkamp from comment #1)
Hi Tobias,
thank you for your reply.

Compatibility is already there, my poudriere builder is running GENERIC:
...
options         COMPAT_FREEBSD9         # Compatible with FreeBSD9
options         COMPAT_FREEBSD10        # Compatible with FreeBSD10
options         COMPAT_FREEBSD11        # Compatible with FreeBSD11
options         SCSI_DELAY=5000         # Delay (in ms) before probing SCSI
...
So it's not a workaround but thanks for suggesting it.

Possible solution would be to bootstrap a new cargo on 12.0 and/or CURRENT.

The problem is that cargo needs itself to build, README.md reads:
cargo build --release
This is a chicken and egg problem, really.


BTW, I agree with #2. ;)
Comment 4 Tobias Kortkamp freebsd_committer 2019-01-30 16:33:56 UTC
Can you share the entire Poudriere build log?
Comment 5 pr 2019-01-30 17:47:41 UTC
Created attachment 201537 [details]
rust-1.30 poudriere log on 12.0 RELEASE
Comment 6 Jan Beich freebsd_committer 2019-01-31 00:24:32 UTC
Comment on attachment 201537 [details]
rust-1.30 poudriere log on 12.0 RELEASE

> KERNCONF=       PAR1

Doesn't look like GENERIC kernel.
Comment 7 Lorenzo Salvadore 2019-02-08 14:36:04 UTC
Created attachment 201840 [details]
rust-1.32.0 poudriere log

I have the same issue.

I tried with GENERIC kernel and it did not work for me either. The log I attach is for version 1.32.0 (should be latest), obtained with poudriere. No KERNCONF line appears: I think this is a confirmation that I really used GENERIC kernel.
Comment 8 Tobias Kortkamp freebsd_committer 2019-03-13 12:46:52 UTC
Comment on attachment 201840 [details]
rust-1.32.0 poudriere log

(In reply to Lorenzo Salvadore from comment #7)
> Created attachment 201840 [details]
> rust-1.32.0 poudriere log
> 
> I have the same issue.
> 
> I tried with GENERIC kernel and it did not work for me either. The log I
> attach is for version 1.32.0 (should be latest), obtained with poudriere. No
> KERNCONF line appears: I think this is a confirmation that I really used
> GENERIC kernel.

This looks like another problem.  Your build goes much further.  Are you
running out of memory?  Do you maybe see something like "out of swap space"
in dmesg after the build aborts?
Comment 9 pr 2019-03-13 14:36:50 UTC
The problem I reported was due to missing compat option in kernel.
The problem reported by Lorenzo is different (his log goes far beyond the point where mine stopps).
In the meantime I reported the problem upstream https://github.com/rust-lang/cargo/issues/6612 so it seems sooner or later we will have a more recent build.
Comment 10 Lorenzo Salvadore 2019-03-14 12:41:47 UTC
(In reply to Tobias Kortkamp from comment #8)

You are right, it was an "out of swap space" problem.

Thank you very much.