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

ACTool task fails build when xcrun actool cannot find tool #21762

Open
AArnott opened this issue Dec 5, 2024 · 7 comments
Open

ACTool task fails build when xcrun actool cannot find tool #21762

AArnott opened this issue Dec 5, 2024 · 7 comments
Labels
need-attention An issue requires our attention/response
Milestone

Comments

@AArnott
Copy link

AArnott commented Dec 5, 2024

Apple platform

iOS

Framework version

net8.0-, net9.0-

Affected platform version

.NET 9.0.100

Description

actool cannot be found, but only when in the context of dotnet build:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net9.0_18.1/18.1.9163/tools/msbuild/iOS/Xamarin.Shared.targets(907,3): /usr/bin/xcrun exited with code 72:
xcrun: error: sh -c '/Applications/Xcode_16.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find actool 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)
xcrun: error: unable to find utility "actool", not a developer tool or in PATH [/Volumes/Expansion/git/nerdbank.cryptocurrencies/src/Nerdbank.Zcash.App/Nerdbank.Zcash.App.iOS/Nerdbank.Zcash.App.iOS.csproj]

If I take exactly the command line from the error message and execute it directly, in the same terminal where I spawned dotnet build, it works:

sh -c '/Applications/Xcode_16.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find actool 2> /dev/null'

I get the path to the actool printed in stdout.

I suspect then that the problem is environment variables set by the ACTool msbuild task, but I can't tell because that information isn't captured by the binlog.

Steps to Reproduce

With the .NET 9.0.101 SDK installed on a mac:

dotnet new maui

Modify the csproj to target .NET 9. (why does the .NET 9 SDK create a .NET 6 targeted maui project anyway??)
Use xcode-select to verify that Xcode 16.1 is selected.

dotnet build -f net9.0-ios

Problem repros.

Did you find any workaround?

No.

Build logs

binlog: msbuild.zip

@AArnott
Copy link
Author

AArnott commented Dec 6, 2024

This happens exactly when I switch to Xcode 16.1 (which .NET 9 targeting requires). If I switch back to Xcode 16.0, it works just fine.

@rolfbjarne
Copy link
Member

This looks like a variation of #3931.

Can you try executing this script, to see if that shows the same error?

https://gist.github.com/rolfbjarne/0cfcd18e187102ad48402aefe2d0f2c4

why does the .NET 9 SDK create a .NET 6 targeted maui project anyway??

That sounds like a different bug (I don't see this behavior). I would suggest filing this in the MAUI repo.

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Dec 6, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Dec 6, 2024
@AArnott
Copy link
Author

AArnott commented Dec 11, 2024

@rolfbjarne That script appears to have worked when targeting Xcode 16.1, both with and without the leading export statements.

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Dec 11, 2024
@rolfbjarne
Copy link
Member

@AArnott and building your project with dotnet build ... from the command line still fails?

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated no-auto-reply For internal use and removed need-attention An issue requires our attention/response labels Dec 12, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the no-auto-reply For internal use label Dec 12, 2024
@AArnott
Copy link
Author

AArnott commented Dec 13, 2024

@rolfbjarne yes.

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Dec 13, 2024
@rolfbjarne
Copy link
Member

Can you add this to your csproj:

<Target Name="_PrintEnvironment" BeforeTargets="_CoreCompileImageAssets">
	<Exec Command="env -0 | sort -z | tr '\0' '\n' > /tmp/actoolenv.txt" />
</Target>

build your project (reproducing the error), and then attach the resulting /tmp/actoolenv.txt file here?

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated no-auto-reply For internal use and removed need-attention An issue requires our attention/response labels Dec 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the no-auto-reply For internal use label Dec 19, 2024
@AArnott
Copy link
Author

AArnott commented Dec 20, 2024

Sure. Here you go, @rolfbjarne:
actoolenv.txt

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

2 participants