3

I recently updated to the latest macos and xcode (14.3) and it's broke my .net build on ios (for the second time). I've made sure to set the SDK location in Visual Preferences > SDK Locations > Apple and confirmed this in the terminal xcode-select -p

  • I've tried different versions of xcode

    I've tried targeting different versions of .net with a global.json including the most recent(7.0.203)

    I've tried targeting different versions of ios, but cannot target higher than 16.4 (SupportedOSPlatformVersion 16.4 cannot be higher than TargetPlatformVersion 16.1)

    I've tried uninstalling and reinstalling all the workloads dotnet workload uninstall ios and dotnet workload install ios

    I've deleted the bin & obj directories

Finally, I've tried creating a new maui project, which works, so I've incrementally added all the libraries the not-working project uses and it still works... WHY

I just keep getting the error:

clang++ exited with code 1:
ld:framework not found System
clang: error: linker command failed with exit code 1
Jimmy
  • 2,191
  • 6
  • 25
  • 45

2 Answers2

4

Adding Microsoft.Identity.Client.Extensions.Msal fixed it.

EVEN THOUGH I WASN'T USING THE LIBRARY??

Jimmy
  • 2,191
  • 6
  • 25
  • 45
1

To begin with, according to [META] Xcode 14.3 Support for Xamarin, .NET 6/7 and MAUI #17561, Xcode 14.3 is not supported, and it is recommended that you use Xcode 14.2 for now. If you have updated to Xcode 14.3 and want to go back to Xcode 14.2 you can download Xcode 14.2 from the downloads page in the Apple Developer Portal.

In addition, the error below means that it's related to Xcode command line tools.

clang++ exited with code 1:
ld:framework not found System
clang: error: linker command failed with exit code 1

You may open Xcode and go to Xcode->Preferences->Location->Command Line Tools and then select a different one.

Hopefully this clears that up a little bit.

Alexandar May - MSFT
  • 6,536
  • 1
  • 8
  • 15
  • Thanks @Alexandar - I've tried 14.3, 14.2, 14.1 and even back to 13.4.1 which was working before. I'm updating the command line tool location as you described, and have tried uninstalling other xcode versions entirely. I've even uninstalled and reinstalled workloads after doing this, as mentioned in my question. Is there something else I'm missing? – Jimmy Apr 26 '23 at 10:35
  • I just nuked my mac, reinstalled everything (xcode 14.2 with command line tools) and still getting the clang++ error. MacOs builds & debugs fine. ios only works for bare bones maui project. – Jimmy Apr 26 '23 at 16:19
  • Thanks for the update. Have you switched the Command Line Tools option to [Xcode 14.2](https://github.com/xamarin/xamarin-macios/issues/17561#issuecomment-1503275700). If it's still not working, I would suggest you can also raise an issue on [Xcode 14.3 Support for Xamarin, .NET 6/7 and MAUI #17561](https://github.com/xamarin/xamarin-macios/issues/17561). – Alexandar May - MSFT Apr 27 '23 at 09:20