You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xcode-select : error : tool 'xcodebuild' requires Xcode - new error with nativeaot in .NET 9 preview 2 #100189
when publishing in release mode, I receive the following errors on my Mac M1 with .NET 9 preview 2, which I do not have with previous versions:
Restore complete (0,3s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
lib2 failed with errors (0,3s) → bin/release/net9.0/osx-arm64/lib2.dll
xcode-select : error : tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance [/Users/llt/Projects/dotnetoni/libs/lib2/lib2.csproj]
/Users/llt/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.0-preview.2.24128.5/build/Microsoft.NETCore.Native.Unix.targets(243,24): error MSB4086: A numeric comparison was attempted on "$(_XcodeVersion)" that evaluates to "" instead of a number, in condition "'$(_XcodeVersion)' >= '15'". [/Users/llt/Projects/dotnetoni/libs/lib2/lib2.csproj]
Build failed with errors in 0,8s
I'm not sure if the same regex works for the build version of other tools.
For reference, on my machine:
> xcodebuild -version
Xcode 15.2
Build version 15C500b
> clang --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /Applications/Xcode-15.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
> ld -v
@(#)PROGRAM:ld PROJECT:dyld-1022.1
BUILD 05:27:37 Dec 7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.8)
Library search paths:
Framework search paths:
> xcrun --show-sdk-version
14.2
> xcrun --show-sdk-build-version
23C53
> xcrun --show-sdk-platform-version
14.2
The clang version only loosely correlates to the Xcode version, so it's not perfect. We'd lose the ability to enable the new ld64 on minor Xcode release, at very least.
Xamarin also has a similar check, so we should double check what they are doing.
the same regex works for the build version of other tools.
The regex picks up the first number that it sees in the output. As far as I can tell, it works for the clang output just fine.
We'd lose the ability to enable the new ld64 on minor Xcode release, at very least.
We just need something simple that works out-of-the-box for the common cases. The logic does not need to be perfect. In case we need to do something extra for minor xcode releases in future, we can deal with once it shows up.
For your information: on my MacBook Air M1 I do not have Xcode installed, only the command line tools. This because it only has 256GB and Xcode is pretty big. Up to now this worked fine up to .NET 9 preview 1 for NativeAOT compilation of asp.net applications.
Activity
dotnet-policy-service commentedon Mar 23, 2024
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.
jkotas commentedon Mar 23, 2024
@LLT21 Please check https://stackoverflow.com/questions/55939354/tool-xcodebuild-requires-xcode-but-active-developer-directory-library-devel for how to work around this issue for now.
This is regression from #97856 / #98726 . cc @VSadov @filipnavara
Can we check e.g.
clang --versionto avoid depending on command-line tools being configured for XCode?Use clang --version to get Apple toolset version
filipnavara commentedon Mar 23, 2024
I'm not sure if the same regex works for the build version of other tools.
For reference, on my machine:
The clang version only loosely correlates to the Xcode version, so it's not perfect. We'd lose the ability to enable the new ld64 on minor Xcode release, at very least.
Xamarin also has a similar check, so we should double check what they are doing.
filipnavara commentedon Mar 23, 2024
https://github.com/xamarin/xamarin-macios/blob/a150c6068c1b5659af4f0b7217bdf572c1e213b4/dotnet/targets/Xamarin.Shared.Sdk.targets#L1599-L1601
https://github.com/xamarin/xamarin-macios/blob/a150c6068c1b5659af4f0b7217bdf572c1e213b4/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocationCore.cs#L210
I don't see whereAppleSdkSettingsis coming from... (and not at my computer at the moment to do proper search)...and
AppleSdkSettingshere, which gets too complicated:https://github.com/xamarin/Xamarin.MacDev/blob/main/Xamarin.MacDev/AppleSdkSettings.cs
filipnavara commentedon Mar 23, 2024
For reference, on the same machine with just command line tools installed:
jkotas commentedon Mar 23, 2024
The regex picks up the first number that it sees in the output. As far as I can tell, it works for the clang output just fine.
We just need something simple that works out-of-the-box for the common cases. The logic does not need to be perfect. In case we need to do something extra for minor xcode releases in future, we can deal with once it shows up.
LLT21 commentedon Mar 23, 2024
For your information: on my MacBook Air M1 I do not have Xcode installed, only the command line tools. This because it only has 256GB and Xcode is pretty big. Up to now this worked fine up to .NET 9 preview 1 for NativeAOT compilation of asp.net applications.
Use clang --version to get Apple toolset version (#100190)
Use clang --version to get Apple toolset version
Use clang --version to get Apple toolset version (#100199)