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

Console output is full of xcrun: error: unable to lookup item 'PlatformVersion' from command line tools installation #1001

Closed
Zalathar opened this issue Mar 8, 2024 · 10 comments · Fixed by #1007 · May be fixed by #1009
Closed

Comments

@Zalathar
Copy link

Zalathar commented Mar 8, 2024

After rust-lang/rust updated cc from 1.0.79 to 1.0.90 (rust-lang/rust#119199), I started seeing several copies of this message appearing on my console during a build:

warning: [email protected]: xcrun: error: unable to lookup item 'PlatformVersion' from command line tools installation
warning: [email protected]: xcrun: error: unable to lookup item 'PlatformVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

warning: [email protected]: xcrun: error: unable to lookup item 'PlatformVersion' from command line tools installation
warning: [email protected]: xcrun: error: unable to lookup item 'PlatformVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

My build still seems to work just fine, so I'm trying to figure out the appropriate way to resolve these annoying console messages.

It seems that the changes made in #943 don't interact nicely with macOS systems that have the command-line developer tools installed, but don't have a full Xcode installation.

@NobodyXu
Copy link
Collaborator

NobodyXu commented Mar 8, 2024

I seem to have the same warnings on my macOS, which also don't have the full xcode installed

cc @BlackHoleFox

@Zalathar
Copy link
Author

Zalathar commented Mar 8, 2024

For reference, the xcrun message is the same as what I would get when running this command manually:

$ 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'

For whatever reason, the --show-sdk-platform-version flag doesn't work with Apple's own CommandLineTools.

@BlackHoleFox
Copy link
Contributor

@Zalathar xcrun --show-sdk-path works still with the CommandLineTools right?

Also would you mind confirming /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/SDKSettings.json exists in your installation? Its been ages since I haven't had the full XCode installed.

@NobodyXu This will get fixed by the patch I'm working on that will handle #963 too.

@Zalathar
Copy link
Author

Zalathar commented Mar 8, 2024

Yes, --show-sdk-path, --show-sdk-version, and --show-sdk-build-version all work fine with CommandLineTools.

It's only --show-sdk-platform-path and --show-sdk-platform-version that are broken.

@Zalathar
Copy link
Author

Zalathar commented Mar 8, 2024

And yes, /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/SDKSettings.json exists and seems to be full of information.

@BlackHoleFox
Copy link
Contributor

Those ended platform flags up not being what I thought they were (shocker, a poorly documented command line flag was deceptive!) so I'm removing their usage soon. The new changeset will just read from the SDK's JSON file (thanks for confirming its there for you) to get the data it needs. This is exactly what clang does so hopefully the weird issues go away.

@ToufeeqP
Copy link

This issue was not there until version 1.0.83, I switched back to 1.0.83 from 1.0.90 and it works.

@eliezhao
Copy link

eliezhao commented Mar 29, 2024

I encountered a similar issue:
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 increase
My Mac information:
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E22

This error message showed that xcrun could not find the version number. After finding the answer in a post on
Stack Overflow, and install the Xcode APP
Finally, I solved the problem by downloading the Xcode application and successfully compiled librocksdb-sys.
Hope this helps you.

@ritalin
Copy link

ritalin commented Apr 3, 2024

I've occured on building duckdb-rs.

In this case, setting MACOSX_DEPLOYMENT_TARGET environment variable led to work around this problem.

export MACOSX_DEPLOYMENT_TARGET=10.11
cargo run

@steezeburger
Copy link

MACOSX_DEPLOYMENT_TARGET=14.4.1 cargo build ... was a workaround for me

oldergod added a commit to oldergod/gradle that referenced this issue May 20, 2024
There has been a change in XCrun and running `xcrun --show-sdk-platform-path`. I'm not sure when it started. I found another project with similar observations at rust-lang/cc-rs#1001

It's failing on CI as well and our PRs just go red because of it like https://github.com/square/wire/actions/runs/9160562085/job/25183490538?pr=2952

```
~/workspace/wire on master*
$ xcrun --show-sdk-platform-path
2024-05-20 17:06:21.697 xcodebuild[74850:2022059] Writing error result bundle to /var/folders/v5/_408d47s3sqf9__x4y6v2p_40000gn/T/ResultBundle_2024-20-05_17-06-0021.xcresult
^[[Axcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

~/workspace/wire on master*
$ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
```

That'd be great to fix it.

Signed-off-by: Benoît Quenaudon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants