Skip to content

xcrun: error: unable to lookup item 'PlatformVersion' from command line tools installation #1311

Closed
@yffwang

Description

@yffwang

I'm compiling a Subtrstrate project on macos with version 15.1.1 (Intel), and I met the problem like this:

cargo:rerun-if-env-changed=CXXFLAGS_x86_64-apple-darwin
CXXFLAGS_x86_64-apple-darwin = None
cargo:rerun-if-env-changed=CXXFLAGS_x86_64_apple_darwin
CXXFLAGS_x86_64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CXXFLAGS
HOST_CXXFLAGS = None
cargo:rerun-if-env-changed=CXXFLAGS
CXXFLAGS = None
cargo:warning=xcrun: error: unable to lookup item 'PlatformVersion' from command line tools installation
cargo:warning=xcrun: error: unable to lookup item 'PlatformVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
cargo:warning=macOS deployment target (10.7) too low, it will be increased

The compiler is the xcode command line tools installed by Homebrew (no xcode app installed), the platform version result is like:

$ xcrun --show-sdk-platform-version
xcrun: error: unable to lookup item 'PlatformVersion' from command line tools installation
xcrun: error: unable to lookup item 'PlatformVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

but if I switched to the Xcode App by this way:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

The platform version would be configured automatically and the compiling would be successful.
So when using the xcode command line tool and cc tool, do we have to specify the platform version in advance, such as by setting the environment variable MACOSX_DEPLOYMENT_TARGET? Otherwise, the entire compilation process will fail due to problems obtaining the platform version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-appleApple targets and toolchains

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions