Skip to content

Linker errors when cross-compiling from Xcode on Big Sur #80817

@irh

Description

@irh

Hi all, invoking cargo build from Xcode on Big Sur currently fails when a crate needs to link against a system library from a build script, unless SDKROOT has been explicitly set to the path of the macOS SDK. Test project here.

When invoking cargo build from an Xcode build script, SDKROOT is set for the platform that's being built. #64254 made it so that SDKROOT gets un-set if the target platform doesn't match the host platform. This seems reasonable to me, but then I don't understand why there's now a difference in behaviour between Xcode and non-Xcode builds.

I logged a similiar issue for cargo-lipo, which has a different workaround of instead setting LIBRARY_PATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crossArea: Cross compilationC-bugCategory: This is a bug.O-macosOperating system: macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions