Cross-compiling a static binary from GitHub Actions
Vladimir Panteleev
thecybershadow.lists at gmail.com
Fri Oct 1 11:18:52 UTC 2021
On Monday, 27 September 2021 at 02:27:32 UTC, kinke wrote:
> Thx, but it doesn't catch my interest - no docker on my
> machine, plus the qemu AArch64 VM is on a different box. I
> haven't heard of any other reports of this kind, and as there
> are AArch64 distro packages of LDC (incl. Android packages
> which I know are used by some people), I guess I would have
> heard if such basic failures were wide-spread.
Rented an AWS EC2 ARM box today and tried it out there. The
std.process segfaults indeed appear to be specific to the
QEMU/binfmt interaction, however, exceptions still did not work.
I narrowed it down to `-static`, confirming your guess. Seems to
be an issue with unwinding?
```
* frame #0: 0x0000000000518180 btdu-static-aarch64`gsignal + 224
frame #1: 0x0000000000400434 btdu-static-aarch64`abort + 244
frame #2: 0x000000000050e1f4
btdu-static-aarch64`uw_init_context_1 + 580
frame #3: 0x000000000050eb44
btdu-static-aarch64`_Unwind_Backtrace + 84
frame #4: 0x000000000054d214 btdu-static-aarch64`backtrace +
68
frame #5: 0x00000000004fb524
btdu-static-aarch64`_D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo + 116
frame #6: 0x00000000004fcf08
btdu-static-aarch64`_d_createTrace + 76
frame #7: 0x00000000004e1a6c
btdu-static-aarch64`_d_throw_exception + 176
frame #8: 0x00000000004399cc
btdu-static-aarch64`_D3std9exception__T7bailOutHTC9ExceptionZQwFNaNfAyamMAxaZNn(file=(length = 39, ptr = u8"/home/ubuntu/btdu/source/btdu/subproc.d"), line=109, msg=(length = 33, ptr = u8"Unexpected subprocess termination")) at exception.d:517:9
```
To reproduce:
```console
$ echo 'import std.stdio, std.process; void main() {
writeln(spawnProcess(["/bin/true"]).wait()); }' > test.d
$ ldc2-1.27.1-linux-aarch64/bin/ldc2 -static test.d
$ ./test
Aborted (core dumped)
```
Worth upgrading this to an issue?
Also, any ideas for workarounds? (Non-static builds lose most
benefits of distributing pre-built binaries in the first place.)
Thanks!
More information about the digitalmars-d-ldc
mailing list