dotnet/maui

clang++ exited with code 1

ericbrunner opened this issue ยท 15 comments

Description

1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7089\targets\Xamarin.Shared.Sdk.targets(1274,3): error : ld: in /Users/erichbrunner/Library/Caches/Xamarin/mtbs/builds/MauiApp1/c7d11821f579f7be20cca70bea58f9077387ac6e7fda6c0f0bf0598883d8d781/obj/Debug/net7.0-ios**/iossimulator-arm64**/linker-cache/AppCenterCrashes.a(MSACErrorReport.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/erichbrunner/Library/Caches/Xamarin/mtbs/builds/MauiApp1/c7d11821f579f7be20cca70bea58f9077387ac6e7fda6c0f0bf0598883d8d781/obj/Debug/net7.0-ios/iossimulator-arm64/linker-cache/AppCenterCrashes.a'
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7089\targets\Xamarin.Shared.Sdk.targets(1274,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation)
1>Done building project "MauiApp1.csproj" -- FAILED.

Steps to Reproduce

  • XCode

image

  • Visual Studio
    image

  • Installed Workloads
    image

Link to public reproduction project repository

https://github.com/ericbrunner/MauiClangError.git

Version with bug

maui-ios 8.0.0-preview.7.8842/8.0.100-preview.7 VS 17.7.34009.444
ios 16.4.8694-net8-p7/8.0.100-preview.7 VS 17.7.34009.444

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iPhone 14 iOS 16.1

Did you find any workaround?

No. I tried to set

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'"> <RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier> </PropertyGroup>
in MAUI .csproj without any working result. Taken from comments of #12124

Relevant log output

see gist of build output pane

Swodah commented

I have the same issue, but my physical device still works. Tried a bunch of things:

  • Reinstalling xcode
  • Reinstalling older xcode version
  • testing on earlier simulator (16.2 instead of the current 16.4)
  • tried the same property fix as op
  • tried deleting various caches on mac, bin and obj folders, dotnet workload restore, nuget restore and restarting visual studio multiple times.
  • Reinstalled visual studio agent on mac
  • Edit tried the old xamarin version of the same app, it could build for simulators.
Eilon commented

@rolfbjarne - any suggestion where this issue should go?

Looks like AppCenter doesn't ship support for the iossimulator-arm64 architecture, so this is an AppCenter issue.

Eilon commented

@rolfbjarne ah good to know. Any idea which of the various AppCenter repos this should go to? There are quite a few: https://github.com/orgs/microsoft/repositories?q=appcenter&type=all&language=&sort=

Closing this as this is a bug in AppCenter. Please open a new issue there.

@rolfbjarne @mattleibow nonesense , that is not an AppCenter issue as can be read here on SO! But how to exclude arm64 for any iPhoneSimulator? Reopen that issue and provide a workaround to mitigate that issue.

@rolfbjarne @mattleibow nonesense , that is not an AppCenter issue as can be read here on SO! But how to exclude arm64 for any iPhoneSimulator? Reopen that issue and provide a workaround to mitigate that issue.

If you want to force x64 when building in Visual Studio, add this to your project:

<PropertyGroup>
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

If you're building from the command line, you need to specify the iossimulator-x64 runtime identifier:

dotnet build /p:RuntimeIdentifier=iossimulator-x64 ...

There seems there's nothing on the MAUI side we can do so we are closing this issue for now. Thanks

<PropertyGroup>
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

Can confirm that it works, but only when you place the <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE> directive inside the PropertyGroup that only tagets the iOS debug build, otherwise the Android Emulator wouldn't start.

Correct one is (if net7.0-ios is the TFM):

	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
		<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
	</PropertyGroup>

There seems there's nothing on the MAUI side we can do so we are closing this issue for now. Thanks

Interesting that the .NET MAUI team is not responsible for tooling issues with .NET MAUI. Who is responsible for such one?

There seems there's nothing on the MAUI side we can do so we are closing this issue for now. Thanks

Interesting that the .NET MAUI team is not responsible for tooling issues with .NET MAUI. Who is responsible for such one?

The underlying issue is that the AppCenter NuGet doesn't support the ARM64 architecture in the simulator.

The answer in the SO link you posted (https://stackoverflow.com/a/73507083) says to tell Xcode to not build for ARM64 (in the simulator).

The answer I posted yesterday (#16778 (comment)) is the equivalent for Visual Studio: it tells Visual Studio to not build for ARM64 (in the simulator).

Both of these answers are just workarounds for the underlying problem: that the AppCenter NuGet doesn't support ARM64 in the simulator.

@rolfbjarne ah good to know. Any idea which of the various AppCenter repos this should go to? There are quite a few: github.com/orgs/microsoft/repositories?q=appcenter&type=all&language=&sort=

Maybe this one: https://github.com/microsoft/appcenter-sdk-dotnet?

@rolfbjarne Thanks for taking the time for explaination

<PropertyGroup>
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

Can confirm that it works, but only when you place the <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE> directive inside the PropertyGroup that only tagets the iOS debug build, otherwise the Android Emulator wouldn't start.

Correct one is (if net7.0-ios is the TFM):

	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
		<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
	</PropertyGroup>

Might be better to put in csproj.user so it doesnt mess with debugging on mac.

You can also condition for Mac, at the top of the csproj there is a condition for windows to add the windows tfm. Just use that and swap to check for macos

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!