Cross-compiling a static binary from GitHub Actions
Vladimir Panteleev
thecybershadow.lists at gmail.com
Sun Sep 26 20:00:15 UTC 2021
On Sunday, 26 September 2021 at 17:31:35 UTC, kinke wrote:
> On Sunday, 26 September 2021 at 13:17:56 UTC, Vladimir
> Panteleev wrote:
>> Well, the build works, but the built program doesn't work.
>> Exceptions cause an abort and I think the process creation
>> problem is still there. Same thing both on my phone and on the
>> qemu docker thing. Maybe because of some difference because
>> it's not the same ARM variant or something?
>
> Hmm, no idea - this basic stuff works for Travis on Ubuntu
> 18.04, incl. a fully green dmd-testsuite, green std.process
> unittests, and using the native dub build to build reggae.
Maybe that's because you have the exactly correct kind of ARM
there?
Here's a full reproducer for the segfault issue:
```
$ docker run --rm -ti arm64v8/ubuntu
```
and in the container:
```
apt-get update
apt-get install -y gcc curl xz-utils libxml2
curl -LfO
https://github.com/ldc-developers/ldc/releases/download/v1.27.1/ldc2-1.27.1-linux-aarch64.tar.xz
tar Jxf ldc2-1.27.1-linux-aarch64.tar.xz
echo 'import std.stdio, std.process; void main() {
writeln(spawnProcess(["/bin/true"]).wait()); }' > test.d
ldc2-1.27.1-linux-aarch64/bin/ldc2 -run test.d
```
> Maybe give it one more shot without `-static` just to see if
> that changes things?
I tried a non-static build on my phone, but that wants
`/lib/ld-linux-aarch64.so.1`, but the Linux userspace I have only
has `/lib/ld-linux-armhf.so.3`. Apparently `size_t` is 32-bit on
`armhf`. However, the statically linked `aarch64` binary does run
- up until an exception is thrown.
More information about the digitalmars-d-ldc
mailing list