Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yffwang opened this issue Dec 3, 2024 · 3 comments
Labels
O-apple Apple targets and toolchains

Comments

@yffwang
Copy link

yffwang commented Dec 3, 2024

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.

@madsmtm madsmtm added the O-apple Apple targets and toolchains label Dec 3, 2024
@madsmtm
Copy link
Collaborator

madsmtm commented Dec 3, 2024

Hmm, cc-rs doesn't invoke xcrun --show-sdk-platform-version, it invokes xcrun --show-sdk-version --sdk macosx.

Does the problem still appear when you run that?

@madsmtm
Copy link
Collaborator

madsmtm commented Dec 3, 2024

Also, what version of cc-rs are you using? Because this might have already been fixed by #1007 (v1.0.94).

@yffwang
Copy link
Author

yffwang commented Dec 3, 2024

using cxx v1.0.121 (built dependency cc v1.0.83)

Ah I noticed the fix #1007 , I think this is the key. Thank you and will try the new version next.

@yffwang yffwang closed this as completed Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-apple Apple targets and toolchains
Projects
None yet
Development

No branches or pull requests

2 participants