Bug 250448 - emulators/qemu-user-static: fails to run devel/llvm10 on 12.1/12.2
Summary: emulators/qemu-user-static: fails to run devel/llvm10 on 12.1/12.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kyle Evans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-19 06:51 UTC by Daniel Tihanyi
Modified: 2020-10-20 13:25 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (emulation)
kevans: merge-quarterly+


Attachments
Poudriere Build log for graphics/mesa-libs 20.2.0_1 (32.30 KB, text/plain)
2020-10-19 06:51 UTC, Daniel Tihanyi
no flags Details
svn(1) diff against the ports tree (1.65 KB, patch)
2020-10-19 18:08 UTC, Kyle Evans
brooks: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tihanyi 2020-10-19 06:51:12 UTC
Created attachment 218877 [details]
Poudriere Build log for graphics/mesa-libs 20.2.0_1

After the update of graphics/mesa-libs to 20.2.0_1 the build fails on FreeBSD 12.1-RELEASE-p10 on arm64 (on qemu) with the message:
meson.build:1475:2: ERROR: Subproject directory not found and llvm.wrap file not found
I attached the Poudriere log for 20.2.0_1. Version 19.0.8_3 builds fine.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2020-10-19 08:20:24 UTC
(In reply to Daniel Tihanyi from comment #0)
> arm64 (on qemu)

I can reproduce: llvm-config10 crashes on 12.1 but not 13.0 (haven't tried 11.4 and 12.2). Affects both both qemu-user-static and qemu-user-static-devel. Affects llvm10 from both /quarterly (pkg.freebsd.org) and /latest (locally built). However, llvm90 and llvm11 work fine on 12.1.

$ llvm-config10
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
$ clang10
Stack dump:
0.      Program arguments: /usr/local/llvm10/bin/clang
qemu: uncaught target signal 6 (Abort trap) - core dumped
Abort trap
Comment 2 Kyle Evans freebsd_committer freebsd_triage 2020-10-19 14:26:55 UTC
Can y'all confirm what version/arch of FreeBSD hosts are at play here?

> I can reproduce: llvm-config10 crashes on 12.1 but not 13.0 (haven't tried 11.4 and 12.2).

When you're reproducing these, is this one -CURRENT/amd64 host and 12.1/13.0 jails that you're running these in, or are they amd64 hosts that match the jail version?
Comment 3 Daniel Tihanyi 2020-10-19 14:32:55 UTC
(In reply to Kyle Evans from comment #2)
Hello Kyle,
In my case I'm running 12.1-RELEASE-p10 on amd64 as host and also 12.1-RELEASE-p10 on arm64 emulated (through Poudriere).
Comment 4 Jan Beich freebsd_committer freebsd_triage 2020-10-19 14:50:31 UTC
(In reply to Kyle Evans from comment #2)
In my case:
- 13.0-CURRENT amd64 host, built 2 days ago
- 13.0-CURRENT aarch64 jail, built on 2020-09-01
- 12.2-RC3 aarch64 jail, built today
- 12.1-RELEASE aarch64 jail, built on 2019-11-05

All jails built with -x (native-xtools).

(In reply to Jan Beich from comment #1)
> (haven't tried 11.4 and 12.2)

llvm10 crashes on 12.2 as well:

$ llvm-config10
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
$ clang10
Stack dump:
0.      Program arguments: /usr/local/llvm10/bin/clang
0  libLLVM-10.so 0x00000040064070c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 68
1  libLLVM-10.so 0x00000040064053f8 llvm::sys::RunSignalHandlers() + 128
2  libLLVM-10.so 0x0000004006407a3c llvm::sys::PrintStackTraceOnErrorSignal(llvm::StringRef, bool) + 1596
3  libthr.so.3   0x0000004002044f9c _pthread_sigmask + 1316
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
Comment 5 Jan Beich freebsd_committer freebsd_triage 2020-10-19 15:02:17 UTC
Hmm, I see the same qemu crash on:
- 12.1 armv6 jail, built on 2019-11-08
- 12.1 armv7 jail, built on 2019-11-08

but not on:
- 13.0-CURRENT armv6, built on 2020-09-01
- 13.0-CURRENT armv7, built on 2020-09-01
Comment 6 Kyle Evans freebsd_committer freebsd_triage 2020-10-19 18:08:12 UTC
Created attachment 218899 [details]
svn(1) diff against the ports tree

Ah, sorry, I should have known this sounded familiar... in-fact, I've solved this once before.

devel/llvm10 needs this backported to it: https://reviews.freebsd.org/rS360875

The TL;DR is that qemu-user-static doesn't currently provide AT_EXECPATH, so llvm runs off the end of auxv in the older versions that don't do elf_aux_info(AT_EXECPATH, ...)

The patch attached should fix it, if brooks approves then we can go ahead and commit it. It's still building locally, but I dont' anticipate the build to fail given how trivial it is.
Comment 7 Brooks Davis freebsd_committer freebsd_triage 2020-10-19 18:20:11 UTC
Comment on attachment 218899 [details]
svn(1) diff against the ports tree

LGTM. Please bump PORTREVISON along with the commit.
Comment 8 Jan Beich freebsd_committer freebsd_triage 2020-10-19 19:45:10 UTC
Can you add "MFH: 2020Q4" (without quotes) to commit message? pkg.freebsd.org doesn't provide /latest packages for non-CURRENT on Tier2 architectures.
Comment 9 Kyle Evans freebsd_committer freebsd_triage 2020-10-19 19:59:14 UTC
(In reply to Jan Beich from comment #8)

Yup, I will MFH it.
Comment 10 Kyle Evans freebsd_committer freebsd_triage 2020-10-19 20:38:58 UTC
I forgot the PR tag, unfortunately, but I committed the llvm10 diff in ports r552764 and will MFH it.
Comment 11 Kyle Evans freebsd_committer freebsd_triage 2020-10-20 00:16:08 UTC
MFH'd as ports r552779, thanks!
Comment 12 Jan Beich freebsd_committer freebsd_triage 2020-10-20 11:22:58 UTC
ports r552764 breaks *native* compiler-rt build on FreeBSD < 13 e.g.,
- 11.4 amd64 failed
- 11.4 i386 failed
- 12.1 aarch64 suceeded
- 12.1 amd64 failed
- 12.1 armv6 suceeded
- 12.1 armv7 suceeded
- 12.1 i386 failed
- 12.2 amd64 failed, see https://reviews.freebsd.org/P446
- 12.2 i386 failed
- 13.0 amd64 succeeded
- 13.0 i386 succeeded

Can you confirm?
Comment 13 commit-hook freebsd_committer freebsd_triage 2020-10-20 11:38:38 UTC
A commit references this bug:

Author: kevans
Date: Tue Oct 20 11:38:05 UTC 2020
New revision: 552813
URL: https://svnweb.freebsd.org/changeset/ports/552813

Log:
  devel/llvm10: fix the patch added in r552764

  A stray semicolon would cause llvm binaries to segfault as they
  always get the wrong "executable path" on 12.1/11.4. Only test built on
  -CURRENT, which doesn't use this path. =(

  Pointy hat:	kevans
  PR:		250478, 250448
  MFH:		2020Q4 (implicit, build fix)

Changes:
  head/devel/llvm10/files/patch-lib_Support_Unix_Path.inc
Comment 14 commit-hook freebsd_committer freebsd_triage 2020-10-20 13:25:55 UTC
A commit references this bug:

Author: kevans
Date: Tue Oct 20 13:25:19 UTC 2020
New revision: 552818
URL: https://svnweb.freebsd.org/changeset/ports/552818

Log:
  MFH: r552813

  devel/llvm10: fix the patch added in r552764

  A stray semicolon would cause llvm binaries to segfault as they
  always get the wrong "executable path" on 12.1/11.4. Only test built on
  -CURRENT, which doesn't use this path. =(

  Pointy hat:	kevans
  PR:		250478, 250448

  Approved by:	ports-secteam (implicit, build fix)

Changes:
_U  branches/2020Q4/
  branches/2020Q4/devel/llvm10/files/patch-lib_Support_Unix_Path.inc