techknowlogick / xgo

Go CGO cross compiler
MIT License
478 stars 79 forks source link

Large memory footprint of ARM-7 Linux target #238

Open cast-espan opened 9 months ago

cast-espan commented 9 months ago

Hello,

I ended here for two reasons. The first is that a standard cross compilation of straight go code to an arm executable consumed a large amount of memory on the target platform, even for a "hello world" type program. I was also unable to create a running target on the ARM target with CGO_ENABLED=1.

The target identifies itself as: root@903cb3bb1f26:/tmp# uname -m armv7l

With CGO_ENABLED, I was using CC=aarch64-linux-gnu-gcc-8

The straight "go" program executes on the target with GOARCH=arm, but not GOARCH=arm64. The gcc cross compiler does not support the pass through -marm command to the compiler, when CGO_ENABLED=1 regardless of whether there are any "C" files or not, and compilation fails.

I have not tried to include "C" code with xgo, being stuck at the large 540M memory consumption of the "GO" executable on the target platform.

Any insight into the memory issue greatly appreciated!