I have copied a hello world Zig program and it runs fine locally on my Mac:
const std = @import("std");
pub fn main() anyerror!void {
// Note that info level log messages are by default printed only in Debug
// and ReleaseSafe build modes.
std.log.info("All your codebase are belong to us.", .{});
}
test "basic test" {
try std.testing.expectEqual(10, 3 + 7);
}
I then cross-compiled it to ARM:
zig build-exe src/main.zig -O ReleaseSmall --strip -target aarch64-linux
Seems to compile the right thing:
$ file ./main
./main: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
Then I copied it to my Raspberry Pi running Ubuntu 22.
It also shows the file is recognized and runs without error, but it just doesn't print anything. I tried redirecting both stdout and stderr to a file but nothing comes out.
What can be the problem?