【问题标题】:Zig std.log.info not printing anything with cross-compiled to AARCH64 binaryZig std.log.info 不打印任何交叉编译为 AARCH64 二进制文件的内容
【发布时间】: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


猜你喜欢
  • 1970-01-01
  • 2018-03-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-07
  • 2011-10-12
  • 1970-01-01
  • 2019-12-11
相关资源
最近更新 更多