Skip to content

Compiling as a library in debug mode for linking into a Unikraft kernel fails when logging due to Thread.getCurrentId implementation #20546

@elerch

Description

@elerch

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

  1. zig init
  2. add std.log.warn("hello world", .{}); to the add function in src/root.zig
  3. add lib.bundle_compiler_rt = true; lib.linkLibC(); to build.zig
  4. zig build
  5. Copy the resultant library into the helloworld-c native unikraft directory (https://github.com/unikraft/catalog/tree/4219b32f3d1cd9fbaa7d50861cc1acd81bfc2362/native/helloworld-c)
  6. Configure and compile unikernel with kraft build --plat qemu --arch x86_64
  7. kraft run --plat qemu --arch x86_64

Program crashes

Expected Behavior

Program should link and run successfully, as it does when the zig library is compiled with -Doptimize=ReleaseSafe

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions