Skip to content

Support building with the Swift Static Linux SDK (musl)Β #1167

Description

@sabafshin

Context πŸ•΅οΈβ€β™€οΈ

The official Swift Static Linux SDK (musl) is used to produce fully-static Linux binaries. It exposes libc as the Musl module rather than Glibc, and musl's glob() lacks the GNU GLOB_BRACE extension.

Building XcodeProj with --swift-sdk *-swift-linux-musl currently fails:

Sources/XcodeProj/Extensions/Path+Extras.swift:12:16: error: cannot find 'Glibc' in scope
    return Glibc.glob(pattern, flags, errfunc, vector_ptr)
           ^
Sources/XcodeProj/Extensions/Path+Extras.swift:38:34: error: cannot find 'GLOB_BRACE' in scope
    let flags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK

What 🌱

Add musl support to the Linux glob path in Path+Extras.swift:

  1. canImport(Musl) branch in systemGlob β†’ Musl.glob
  2. Guard GLOB_BRACE out on musl only (GNU extension, absent from musl glob.h)

Proposal πŸŽ‰

Same pattern already accepted upstream in jpsim/Yams (PR #477) and proposed for SwiftCLI: an additive #if os(Linux) && canImport(Musl) branch that leaves glibc/macOS behavior untouched. A ready patch exists in a fork and can be attached to the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions