Skip to content

zig fails to detect musl as the native C ABI on alpine linux  #2084

Closed
@andrewrk

Description

@andrewrk

executing zig targets on alpine linux shows:

...
C ABIs:
  none
  gnu (native)
  gnuabin32
  gnuabi64
...

Instead it should detect that musl is the native C ABI on alpine linux.

Here are my ideas for detecting this:

  • Zig should look at its own dynamic linker. This will determine which C ABI is native.
  • If Zig is statically linked, then it should look at the dynamic linker of /usr/bin/env.
  • If there is a problem accessing /usr/bin/env or determining its dynamic linker, Zig should conclude that the native C ABI is musl.

This only matters really if you use --library c and in this case you can work around it with -target x86_64-linux-musl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.stage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions