Skip to content

[BUG] hello_zig fails to build on sim:x86_64 with Zig 0.13.0 #19475

Description

@ML-dev-crypto

Description / Steps to reproduce the issue

Description / Steps to reproduce the issue

While testing the Zig hello_zig example on sim:x86_64, I found that it cannot be built with Zig 0.13.0 due to two build issues.

Steps to reproduce

  1. Configure NuttX for sim:x86_64.
  2. Enable the Zig hello example:
    CONFIG_EXAMPLES_HELLO_ZIG=y
    
  3. Build NuttX.

The build first fails because tools/Zig.defs generates the following target:

-target x86_64-freestanding-sysv

However, Zig reports:

error: unknown ABI: 'sysv'

After locally changing the target to a Zig-supported ABI, the build proceeds further but then fails during linking with:

undefined reference to `__zig_probe_stack'

The generated Zig object references __zig_probe_stack, but the required compiler runtime is not linked.

After applying local changes, the project builds successfully and the example runs correctly:

NuttShell (NSH)

nsh> hello_zig
[sim]: Hello, Zig!

At this point I'm unsure what the preferred upstream approach is for addressing these two build issues, so I'm opening this issue first before preparing a patch.


On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu 24.04 LTS (WSL2)

NuttX Version

master

Issue Architecture

[Arch: x86], [Arch: x86_64]

Issue Area

[Area: Build System]

Host information

Host information

  • Zig 0.13.0
  • GCC host toolchain
  • x86_64 Linux (WSL2)

Verification

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arch: x86Issues related to the x86 architectureArch: x86_64Issues related to the x86_64 architectureArea: Build systemOS: LinuxIssues related to Linux (building system, etc)Type: BugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions