Skip to content

Add some sort of -Clink-sdkroot=... flag? #146345

@madsmtm

Description

@madsmtm

rustc uses the SDKROOT environment variable to figure out details about the SDK to pass onward to the linker (linker stubs and the SDK version). If this flag is not set, or is set for the wrong platform, we fall back to invoking xcrun --sdk $platform --show-sdk-path.

It might be beneficial to add a commandline flag to allow passing this information as well? This has been requested by Chromium in #131477 (comment), see that for motivation.

Alternatively / additionally, we could add a flag to completely opt out of passing SDK information to the linker, such as -Clinker-features=-sdkroot (partially reverting to the state before #131477). Such a flag might also be useful for e.g. cargo zigbuild (which provides the SDK internally).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-feature-requestCategory: A feature request, i.e: not implemented / a PR.E-needs-designThis issue needs exploration and design to see how and if we can fix/implement itO-appleOperating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions