Cross-compiling a static binary from GitHub Actions
kinke
noone at nowhere.com
Fri Oct 1 11:41:06 UTC 2021
On Friday, 1 October 2021 at 11:18:52 UTC, Vladimir Panteleev
wrote:
> 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
> ```
Hmm, apparently coming from libbacktrace. IIRC, EH and backtrace
code in druntime for Linux AArch64 doesn't really diverge from
x64.
I guess you *could* try compiling druntime manually, defining
`version (DRuntime_Use_Libunwind)` to use libunwind instead of
libbacktrace. See
https://wiki.dlang.org/Building_LDC_runtime_libraries for how to
do that quite painlessly.
More information about the digitalmars-d-ldc
mailing list