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

MAUI ios application build fails with clang error code 137 #21649

Closed
PureWeen opened this issue Nov 18, 2024 · 21 comments
Closed

MAUI ios application build fails with clang error code 137 #21649

PureWeen opened this issue Nov 18, 2024 · 21 comments
Labels
need-info Waiting for more information before the bug can be investigated

Comments

@PureWeen
Copy link


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Wednesday, October 30, 2024 12:56:35 PM

Description

I am unable to publish my application with latest dotnet workload and xcode 16.1. I moved to latest preview version to see if the bug is resolved there, with out much luck. The problem sarted to appear in 8.0.403 also.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.0-rc.2.24503.2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

No response

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

(TaskId:514)
Tool xcrun execution started with arguments: clang -g -mios-version-min=14.2 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.1.sdk -Xlinker -rpath -Xlinker @executable_path/ -Qunused-arguments -x assembler -D DEBUG -o /Users/xamarinbuild/Library/Caches/Xamarin/mtbs/builds/MAUISsiSample/241166cc9d9f5de6b41fd647e763c7a49c7c3831636823dc1d1b3224325db5ac/obj/Release/net8.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Trimble.Ssi.Core.dll.o -c /Users/xamarinbuild/Library/Caches/Xamarin/mtbs/builds/MAUISsiSample/241166cc9d9f5de6b41fd647e763c7a49c7c3831636823dc1d1b3224325db5ac/obj/Release/net8.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Trimble.Ssi.Core.dll.s
(TaskId:514)
Tool xcrun execution finished (exit code = 137).

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607

  • Please respond to @similar-issues-ai[bot].

From @similar-issues-ai[bot] on Wednesday, October 30, 2024 12:56:49 PM

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Wednesday, October 30, 2024 1:05:46 PM

Attached build diagnostic and binary logs.
buildlog.zip

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @jfversluis on Wednesday, October 30, 2024 2:55:35 PM

@dalexsoto @rolfbjarne ?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Wednesday, October 30, 2024 3:19:25 PM

This is strange, every invocation of clang crashes.

Does this also happen if you try with a new project created from a template?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Friday, November 1, 2024 11:59:25 AM

Hello,
I was able to reproduce the problem with template project also. I have attached the build log BuildLogs.zip. Build is started using dotnet build command from command line like this:
dotnet build /p:IsPublishing=true;ArchiveOnBuild=true iOSApp1.csproj -c:Release -f:net8.0-ios -p:RuntimeIdentifier=ios-arm64 /p:ServerUser=server-user /p:ServerAddress=server-ip-address -bl:build.binlog -fl -flp:logfile=build.log;verbosity=diagnostic

When building the same project from visual studio I get a different error complaining about missing install_name_tool. Attached the build log from vs visual_studio_build_log.zip
install_name_tool name is installed and available in path. When I "type install_name_tool" I get "install_name_tool is /usr/bin/install_name_tool" in the OSX terminal.

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Monday, November 4, 2024 5:49:51 PM

@Abhirasmanu-Trimble do you have this file on your Mac:

~/Library/Preferences/Xamarin/Settings.plist

and if you do, can you try deleting it to see if that fixes the problem?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Monday, November 4, 2024 6:22:42 PM

Hello @rolfbjarne,

I do not have this file on my mac.

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Tuesday, November 5, 2024 11:24:26 AM

@Abhirasmanu-Trimble can you run the following in a terminal on your Mac, and paste the output here:

xcode-select -p
sudo xcode-select -s /Applications/Xcode.app

and then try again?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Tuesday, November 5, 2024 12:34:51 PM

Hi @rolfbjarne,
FYI
~ % xcode-select -p
(Result)->/Applications/Xcode.app/Contents/Developer

I still get the same clang error in build

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Tuesday, November 5, 2024 4:07:12 PM

@Abhirasmanu-Trimble does the project build if you build it from the command line on the Mac? If not, can you attach the corresponding binlog?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Wednesday, November 6, 2024 11:16:34 AM

@rolfbjarne , the build does work when directly built form mac command line (ssh also works). I could not create binlog or daignostic log since the the parameters are not recognized. Detailed log is seems to be generated automatically (no idea why). I have attached the default msubild.log here.msbuild.zip
This was command I ran from the command line.
dotnet publish -r:ios-arm64 /p:BuildIpa=true -c:Release -f:net8.0-ios -fl -flp:loggile=build.log;verbosity=diagnostic -bl:build.binlog

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Wednesday, November 6, 2024 6:35:56 PM

@Abhirasmanu-Trimble does it still fail from Windows if you try with a new project from a template?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Thursday, November 7, 2024 8:49:14 AM

@rolfbjarne Template project build from windows machine still fails.

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Thursday, November 7, 2024 5:58:05 PM

So this looks related to #3931, where Xcode's tooling gets confused because there are multiple versions of Xcode in play.

Did you ever have more than one version of Xcode installed, or Xcode installed in any other location that /Applications/Xcode.app?

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Friday, November 8, 2024 7:08:40 PM

One of the Macs I used for building the projects has multiple Xcode installations. However, I was able to reproduce the crash on another Mac with a single Xcode installation.

Additionally, the issue first appeared on the Mac (which now has multiple Xcode versions) when it only had one Xcode installation. I installed multiple older Xcode versions (15.2 - 15.4) to see if using previous versions could resolve the problem.

One additional note : We also have a xamarin ios project which we directly build in the Mac (Sonoma 14.5) and that also has a similar crash. In that case, first "pngcrush" crashed with 137 code. After disabling png optimization I get below error:
(_CompileToNative target) ->
MTOUCH : error MT4109: Failed to compile the generated registrar code.

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Friday, November 8, 2024 9:23:16 PM

One additional note : We also have a xamarin ios project which we directly build in the Mac (Sonoma 14.5) and that also has a similar crash. In that case, first "pngcrush" crashed with 137 code. After disabling png optimization I get below error:
(_CompileToNative target) ->
MTOUCH : error MT4109: Failed to compile the generated registrar code.

Can you get an MSBuild binlog for this build failure?

That might be easier to diagnose, because Windows doesn't enter the picture.

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @Abhirasmanu-Trimble on Monday, November 11, 2024 11:23:47 AM

@rolfbjarne Xamarin build logs attached
xamarin-build-logs.zip

@PureWeen
Copy link
Author


Issue moved from dotnet/maui#25607


From @rolfbjarne on Monday, November 18, 2024 9:10:47 AM

I'm a bit stumped here, but I have a few more ideas:

Can you try to open Xcode, create a new project and build that to see if that works? If it does, try the .NET/Xamarin project again, as sometimes Xcode auto-fixes problems.

If it still doesn't work, please zip up and attach this directory from the Mac:

~/Library/Logs/DiagnosticReports

which should contain crash reports for the clang compiler.

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Nov 19, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Nov 19, 2024
@Abhirasmanu-Trimble
Copy link

Project created using xcode is working. But the msbuild still fails. My ~/Library/Logs/DiagnosticReports is empty. Does this have to be enabled ?

@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 Nov 19, 2024
@rolfbjarne
Copy link
Member

My ~/Library/Logs/DiagnosticReports is empty. Does this have to be enabled ?

No, it doesn't have to be enabled, but it's where crash reports are stored, which makes it even stranger why there aren't any crash reports when clang is clearly crashing.

The next step is to gather an extensive log for the system using the Console app: https://support.apple.com/en-in/guide/console/cnsl1012/mac

Basically start streaming log messages in the Console app for the Mac, build (and reproduce the build breakage), then stop streaming, save the log and attach it 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 Nov 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the no-auto-reply For internal use label Nov 19, 2024
Copy link
Contributor

Hi @PureWeen. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-info Waiting for more information before the bug can be investigated
Projects
None yet
Development

No branches or pull requests

3 participants