Bug 221185 - emulators/qemu-user-static: fails to run lang/rust
Summary: emulators/qemu-user-static: fails to run lang/rust
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Sean Bruno
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-02 19:14 UTC by Jan Beich
Modified: 2020-10-05 06:23 UTC (History)
8 users (show)

See Also:


Attachments
poudriere log (38.79 KB, text/plain)
2017-08-02 19:14 UTC, Jan Beich
no flags Details
poudriere log (rust-1.21.0) (40.40 KB, text/plain)
2017-10-25 15:44 UTC, Jan Beich
no flags Details
patch (639 bytes, patch)
2019-02-21 11:58 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-08-02 19:14:51 UTC
Created attachment 184965 [details]
poudriere log

$ poudriere jail -cj 111aarch64 -x -a arm64.aarch64 -v 11.1-RELEASE
$ poudriere bulk -Ctj 111aarch64 www/firefox # fails in lang/rust

$ poudriere jail -sj 111aarch64
<configure network in the jail>
$ env -i TERM=$TERM /usr/sbin/jexec 111aarch64-default /bin/sh
$ export ABI=FreeBSD:11:aarch64 UNAME_r=11.1-RELEASE

$ pkg install -qy rust
$ echo 'fn main() {}' >a.rs
$ rustc a.rs
Fatal error 'exception should be rethrown' at line 129 in file /usr/src/lib/libthr/thread/thr_exit.c (errno = 2)
qemu: uncaught target signal 6 (Abort trap) - core dumped
Abort trap
Comment 1 Sean Bruno freebsd_committer 2017-08-03 15:47:39 UTC
Just for my sanity, does this run on real hardware?
Comment 2 Jan Beich freebsd_committer 2017-08-03 17:25:22 UTC
Yep, comment 0 test works fine on ref11-aarch64 (base r319064 atm) and ref12-aarch64.
lang/rust uses prebuilt version of rustc during build, and at least 1.18.0 built fine:
http://thunderx1.nyi.freebsd.org/data/latest-per-pkg/rust/1.18.0/
Comment 3 Jan Beich freebsd_committer 2017-10-24 18:36:52 UTC
rust-1.20.0 seems to build/run fine if one restarts cargo/rustc every time it randomly hangs or crashes. I've even managed to build unpatched Firefox 58 this babysitting way.

$ file rustc-*-aarch64-unknown-freebsd/rustc/bin/rustc
rustc-1.17.0-aarch64-unknown-freebsd/rustc/bin/rustc: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100122), FreeBSD-style, not stripped
rustc-1.18.0-aarch64-unknown-freebsd/rustc/bin/rustc: ELF 64-bit LSB shared object, ARM aarch64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100513), FreeBSD-style, not stripped
rustc-1.19.0-aarch64-unknown-freebsd/rustc/bin/rustc: ELF 64-bit LSB shared object, ARM aarch64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100513), FreeBSD-style, not stripped
rustc-1.20.0-aarch64-unknown-freebsd/rustc/bin/rustc: ELF 64-bit LSB shared object, ARM aarch64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100513), FreeBSD-style, not stripped

$ rustc-1.17.0-aarch64-unknown-freebsd/rustc/bin/rustc -vV
rustc 1.17.0 (56124baa9 2017-04-24)
binary: rustc
commit-hash: 56124baa9e73f28c0709e59e74783cf234a978cf
commit-date: 2017-04-24
host: aarch64-unknown-freebsd
release: 1.17.0
LLVM version: 3.9
Fatal error 'exception should be rethrown' at line 128 in file /poudriere/jails/head-aarch64/usr/src/lib/libthr/thread/thr_exit.c (errno = 0)
Segmentation fault

$ rustc-1.18.0-aarch64-unknown-freebsd/rustc/bin/rustc -vV
rustc 1.18.0 (03fc9d622 2017-06-06)
binary: rustc
commit-hash: 03fc9d622e0ea26a3d37f5ab030737fcca6928b9
commit-date: 2017-06-06
host: aarch64-unknown-freebsd
release: 1.18.0
LLVM version: 3.9
Fatal error 'exception should be rethrown' at line 128 in file /poudriere/jails/head-aarch64/usr/src/lib/libthr/thread/thr_exit.c (errno = 0)
Segmentation fault

$ rustc-1.19.0-aarch64-unknown-freebsd/rustc/bin/rustc -vV
rustc 1.19.0 (0ade33941 2017-07-17)
binary: rustc
commit-hash: 0ade339411587887bf01bcfa2e9ae4414c8900d4
commit-date: 2017-07-17
host: aarch64-unknown-freebsd
release: 1.19.0
LLVM version: 4.0
Fatal error 'exception should be rethrown' at line 128 in file /poudriere/jails/head-aarch64/usr/src/lib/libthr/thread/thr_exit.c (errno = 0)
Segmentation fault

$ rustc-1.20.0-aarch64-unknown-freebsd/rustc/bin/rustc -vV
rustc 1.20.0 (f3d6973f4 2017-08-27)
binary: rustc
commit-hash: f3d6973f41a7d1fb83029c9c0ceaf0f5d4fd7208
commit-date: 2017-08-27
host: aarch64-unknown-freebsd
release: 1.20.0
LLVM version: 4.0


$ make -C lang/rust
[...]
   Compiling num-traits v0.1.40
     Running `/wrkdirs/usr/ports/lang/rust/work/rustc-1.21.0-src/build/aarch64-unknown-freebsd/stage0/bin/rustc --crate-name num_traits src/vendor/num-traits/src/lib.rs --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=70b5f35f2a57f99e -C extra-filename=-70b5f35f2a57f99e --out-dir /wrkdirs/usr/ports/lang/rust/work/rustc-1.21.0-src/build/bootstrap/debug/deps -L dependency=/wrkdirs/usr/ports/lang/rust/work/rustc-1.21.0-src/build/bootstrap/debug/deps --cap-lints allow`
qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x6022324e
load: 1.40  cmd: qemu-aarch64-static 23867 [uwait] 109.59r 5.71u 0.03s 0% 254640k
Comment 4 Jan Beich freebsd_committer 2017-10-25 15:44:46 UTC
Created attachment 187465 [details]
poudriere log (rust-1.21.0)
Comment 5 Jan Beich freebsd_committer 2017-11-08 10:20:50 UTC
Looks like rust-1.20.0 only worked by luck.

$ pkg install rust
$ rustc -vV
rustc 1.21.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: aarch64-unknown-freebsd
release: 1.21.0
LLVM version: 4.0
Fatal error 'exception should be rethrown' at line 128 in file /poudriere/jails/head-aarch64/usr/src/lib/libthr/thread/thr_exit.c (errno = 0)
Abort trap
Comment 6 Tobias Kortkamp freebsd_committer 2019-02-20 19:33:07 UTC
This is still a problem and actual since enabling building of
lang/rust on armv6/armv7/aarch64 in ports r493268.

The arvm7+QEMU build of lang/rust failed after taking > 21600 seconds
to compile the cfg-if crate [1].

aarch64+QEMU isn't any better and hangs eventually too.

[1] http://beefy16.nyi.freebsd.org/data/head-armv7-default/p493345_s344269/logs/rust-1.32.0.log
Comment 7 Mikael Urankar freebsd_committer 2019-02-21 11:58:16 UTC
Created attachment 202230 [details]
patch

It's only a problem on armv6/7, we use real hw for building pkg on aarch64 and ppc64.

The attached patch prevents building rust with qemu-user and try to clarify the situation on aarch64
Comment 8 Tobias Kortkamp freebsd_committer 2019-02-21 12:25:54 UTC
(In reply to mikael.urankar from comment #7)
+.if ${ARCH} == aarch64
+WARNING+=	"Due to a bug in rtld, rust fails to run on 11.2-RELEASE and 12.0-RELEASE \
+		you can either update /libexec/ld-elf.so.1 from -STABLE or -CURRENT \
+		or run -STABLE or -CURRENT"
+.endif

Which revisions do users need to upgrade to?  We might as well set
IGNORE for older OSVERSIONs on aarch64.

+.ifdef QEMU_EMULATING
+IGNORE=	qemu-user-static isn't able to build lang/rust, but it builds fine on a real hardware
+.endif

Ok.
Comment 9 Mikael Urankar freebsd_committer 2019-02-21 12:54:54 UTC
(In reply to Tobias Kortkamp from comment #8)
for 12-stable: base r342847
for -current: base r342113

no mfc on 11-stable afaict
Comment 10 commit-hook freebsd_committer 2019-02-21 19:04:13 UTC
A commit references this bug:

Author: tobik
Date: Thu Feb 21 19:03:17 UTC 2019
New revision: 493523
URL: https://svnweb.freebsd.org/changeset/ports/493523

Log:
  lang/rust: Ignore with qemu-user-static and on aarch64 without fixed ld-elf.so.1

  - Rust will not run without a fixed ld-elf.so.1 on aarch64
  - Builds with qemu-user-static currently hang after a while

  PR:		221185
  Submitted by:	Mika?l Urankar <mikael.urankar@gmail.com>

Changes:
  head/lang/rust/Makefile
Comment 11 Mateusz Piotrowski freebsd_committer 2020-10-04 20:25:45 UTC
Could this issue be closed? It looks like some patches were committed...
Comment 12 Mikael Urankar freebsd_committer 2020-10-05 06:23:09 UTC
(In reply to Mateusz Piotrowski from comment #11)
qemu-user-static can't build lang/rust, it's still an issue.