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
Just for my sanity, does this run on real hardware?
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/
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
Created attachment 187465 [details] poudriere log (rust-1.21.0)
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
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
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
(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.
(In reply to Tobias Kortkamp from comment #8) for 12-stable: base r342847 for -current: base r342113 no mfc on 11-stable afaict
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
Could this issue be closed? It looks like some patches were committed...
(In reply to Mateusz Piotrowski from comment #11) qemu-user-static can't build lang/rust, it's still an issue.
This might be fixed, but I've got a local patch that will almost certainly solve this issue -- _umtx_op handling has been the bane of my existence, and I'm looking to offload it entirely to the kernel going forward. My local patch allows this by introducing a 32bit flag to _umtx_op commands which qemu-bsd-user can then set to indicate to the kernel that it's looking at 32-bit structures. The new logic is used for any target where the endianness matches the host's, so 64-bit amd64 can natively handle armv7 or aarch64 while it's forced to fallback to the still-slightly-buggy emulation of _umtx_op for, e.g., mips.