【发布时间】:2022-06-10 19:19:08
【问题描述】:
我复制了一个 hello world Zig 程序,它在我的 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);
}
然后我将它交叉编译到 ARM:
zig build-exe src/main.zig -O ReleaseSmall --strip -target aarch64-linux
似乎编译正确:
$ file ./main
./main: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
然后我将它复制到运行 Ubuntu 22 的 Raspberry Pi 中。
它还显示文件已被识别并且运行时没有错误,但它只是不打印任何内容。我尝试将 stdout 和 stderr 都重定向到一个文件,但没有任何结果。
可能是什么问题?
【问题讨论】:
-
我正在使用 Zig 0.10,我刚刚从下载页面下载。
标签: zig