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

clang++ exited with code 1 #16778

Closed
ericbrunner opened this issue Aug 16, 2023 · 15 comments
Closed

clang++ exited with code 1 #16778

ericbrunner opened this issue Aug 16, 2023 · 15 comments
Labels
partner Issue or Request from a partner team platform/iOS 🍎 t/bug Something isn't working

Comments

@ericbrunner
Copy link

ericbrunner commented Aug 16, 2023

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

@ericbrunner ericbrunner added the t/bug Something isn't working label Aug 16, 2023
@Swodah
Copy link

Swodah commented Aug 16, 2023

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
Copy link
Member

Eilon commented Aug 16, 2023

@rolfbjarne - any suggestion where this issue should go?

@rolfbjarne
Copy link
Member

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

@Eilon
Copy link
Member

Eilon commented Aug 16, 2023

@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=

@mattleibow mattleibow added the partner Issue or Request from a partner team label Aug 16, 2023
@mattleibow
Copy link
Member

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

@mattleibow mattleibow closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2023
@ericbrunner
Copy link
Author

ericbrunner commented Aug 16, 2023

@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.

@Eilon Eilon reopened this Aug 16, 2023
@rolfbjarne
Copy link
Member

@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 ...

@rmarinho
Copy link
Member

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

@ericbrunner
Copy link
Author

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

@ericbrunner
Copy link
Author

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?

@rolfbjarne
Copy link
Member

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?

@ericbrunner
Copy link
Author

@rolfbjarne Thanks for taking the time for explaination

@alanspires
Copy link

<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.

@mattleibow
Copy link
Member

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

@ghost
Copy link

ghost commented Sep 2, 2023

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!

@dotnet dotnet locked as resolved and limited conversation to collaborators Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
partner Issue or Request from a partner team platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants