My first cross-compiling attempt with zig was great.
I wanted to compile my podcast player on the big x86_64 machine to run on the smaller aarch64 FuriPhone FLX1 phone.
Both run Linux, and I had already successfully compiled on the phone itself, but the edit/debug cycle was too long.
So first up, find out what the phone target is, by running zig targets
which produces tons of output, but at the bottom:
"native": {
"triple": "aarch64-linux.4.19.325...4.19.325-gnu.2.39",
"cpu": {
"arch": "aarch64",
"name": "cortex_a78",
So let's try that:
$zig build -Dtarget=aarch64-linux.4.19.325...4.19.325-gnu.2.39
But I got this error:
/home/dvanderson/.cache/zig/p/122004e82d4a0c61a9c414539c1f87bb125cb2b293573af77b153ea3903cb209b65b/library/aesce.c:182:18:
error: always_inline function 'vaesimcq_u8' requires target feature 'aes',
but would be inlined into function 'mbedtls_aesce_inverse_key'
that is compiled without support for 'aes'
It looks like I need to also pass some -Dcpu=
, so again using the output of zig targets
from above:
$zig build -Dtarget=aarch64-linux.4.19.325...4.19.325-gnu.2.39 -Dcpu=cortex_a78
And that worked!
Note that this is all with zig 0.13, and there are a few issues that might change how to pass the target/cpu/libc/abi information in the future.
Latest comments (1)
i learn so much from your page