-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: Could not compile native assembly file: environment.arm64-v8a.ll #14531
Comments
@jonathanpeppers Thoughts? |
I think we need a repro or MSBuild diagnostic log. |
Hi @arvindrajachourasiya. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@jonathanpeppers @jsuarezruiz Please find attached file with MSBuild diagnostic log Output. Original log txt file was 57MB, it was not being uploaded. I have uploaded same file in zip format. Please check that. Seem other people as well facing same issue. Below find few links Please let me know if you need more information. |
@arvindrajachourasiya looking at the error message in the log:
What are the contents of I don't see a custom |
@arvindrajachourasiya could you attach the |
@jonathanpeppers once I have the file, I can run |
@jonathanpeppers @grendello - Please find the files below. I have attached 4 files there as I am getting 4 errors. Below is the screenshots of errors. When I keep building my project, every time I get different error (out of 4) and sometimes all 4 errors are coming. This time I am getting all the errors. Added screenshots and logs. Log file for 4 errors |
@arvindrajachourasiya @jonathanpeppers so it's both good and bad news. The files attached by @arvindrajachourasiya, thank you, compile just fine. That's the good news. The bad news, there's no actual error in the provided log and I suspect the failure being environmental - something on the machine is causing the process to fail. Shortage of disk space, resource limits imposed by the OS, a filesystem corruption all come to mind but it's impossible to say what it is in the absence of actual errors :( @arvindrajachourasiya I'm afraid I will need to ask you to build the app from command line, producing a binlog file, hoping it will have more info. Please build the app as follows from VS developer command prompt (after first removing all the dotnet build -bl Please attach the failed build's |
@grendello - I have done building app from VS Command Prompt and attached log file. Please find it. I am not sure how to get |
@arvindrajachourasiya Thanks for the log, it shows a sharing violation error:
I wonder if the build errors you've seen earlier are of the same nature. Regarding |
@grendello - I got |
If you try it again, do you still get:
Do you have any third-party antivirus installed? In the past, we've seen them lock files on Windows and cause builds to fail randomly. |
@jonathanpeppers - Please find latest log. In my Windows 11 I have Forcepoint One Endpoint and Digital Guardian Agent. I think there is no other Antivirus. |
@arvindrajachourasiya thank you for the log. The first I think the problem here might be the feuding antiviruses - together with the two you mentioned, there's also MS Defender which is (I think) active by default. They might be interfering with each other and your build process :( |
@grendello - if MS Defender is the issue (or any other application) please let me know that solution, how can I make it work ? Why all other people are not facing same issue as MS Defender comes by default with Windows OS. Thank you. |
@grendello I'm not saying that MS Defender is the one that's causing problems - it might be interaction between the various antivirus software, including MS Defender, that causes the problem. We've had a share of issues related to file locking due to various antivirus programs. However, in your case it's a guessing game since we don't see the cause of the error, just the effect. To try to determine whether antivirus software is the problem here, turn off all but one of them and see if that fixes the problem. For other causes, check hard disk/ssd health, filesystem health (a simple test would be to copy the application source code to a separate disk disk and see if the problem occurs there) |
@grendello - For most of apps including MS Defender, I can't change the settings. It is managed by organization. I am checking more on that. Please find MAUI project code in attached file. To check the same code base in other machines/laptop seems bit difficult to me as I do not have other machines with all the environment enabled. Please have a look on my code. Thank you. |
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
@arvindrajachourasiya thanks for the app sample, however the problem in this issue isn't related to your code (or the one we generate). The app builds fine for me, I get the On my part (code generation) I'm afraid I can't help much here, as everything in that department appears to check out. Perhaps @jonathanpeppers or @dellis1972 can come up with an idea of how to work around the file locking issue. |
In the past I have had to ask the Corporate IT department to allow exclusions on Developer Machines. This allows developers to exclude certain folders which are used for compiling etc from the virus scanners. |
@dellis1972 @grendello - I have to write to my IT Department related to this issue. In the past I have had to ask the Corporate IT department to allow exclusions on Developer Machines. This allows developers to exclude certain folders which are used for compiling etc from the virus scanners. Could you please let me know what folders/files I might need to mention in my request to exclude them ? I will help me. Thank you. |
@dellis1972 @grendello - My issue and this issue dotnet/android#7939 isn't same ? Can I assume you are not able to help me on this issue ? or you people are checking this ? |
@grendello @dellis1972 I tried the build again and it was successful. I've done some investigation and the problem was the modified Xamarin.Android.Build.Tasks.dll (which was running the llc.exe processes in sequence rather than parallel). I had swapped back to the original Xamarin.Android.Build.Tasks.dll, but I had not restarted Visual Studio after doing this and it looks like it was still using the modified dll. (I went through the same steps again and I could reproduce the error with the modified dll and having swapped to the original dll without restarting Visual Studio) So I think this is a fix for the error! Please note that I am overwriting the existing ld.exe with the lld.exe file provided. If I don't do that I get different build errors. i.e. I have also tested this with Xamarin.Forms 5.0.0.2599-pre1, replacing the files in the directory C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin. I have been able to build that app successfully too. |
@ilamble excellent news, thanks! :) A PR is underway to switch us to LLVM 16 without UPX, so hopefully it will make into next releases soon. @arvindrajachourasiya, @ccanbek89 could you please follow the steps described in comment above (ignore the |
Thank you for all your help @grendello! |
@grendello - Our Project migration to MAUI is on hold until further notice. I have checked Xamarin.Forms project. Now I am getting this error in Xamarin.forms project
After replacing
Steps I followed.
|
@arvindrajachourasiya I copied the lld.exe file and renamed the copy ld.exe. I then overwrote the existing ld.exe file with the new file. That worked for me. |
@ilamble - Wow! That worked for me. In a long time, I have seen Build Succeeded. So now can we use our application for production purpose, or will it behave strange as it is kind of manipulated version? |
@arvindrajachourasiya My understanding is that we are ok to use this for production purposes, but I will let @grendello confirm. |
Yes, it's fine to use the binaries for production. They are unmodified upstream LLVM 16 (the default stable release) binaries, simply compiled in a fashion that fits our needs (so that they are smaller). |
@arvindrajachourasiya can you test the MAUI app build anyway, please? Replace the binaries in |
@ilamble do you still have the older, 15.0.7, UPX-packed binaries perchance? If yes, could you see if this workaround makes the binary work for you after unpacking? |
@grendello I saw that yesterday and tried it :) UPX still crashes for me with --strip-relocs=0 set (error code -1073741819) I've just tried it again to confirm. That's with UPX 4.0.2.0 |
@ilamble thanks :) |
@grendello - Original MAUI app also worked. 😀 |
@arvindrajachourasiya excellent, thanks! |
Hello @arvindrajachourasiya , @grendello , I'm also facing the same issue with my VS solution. Could you please elaborate what exact changes you have made to resolve this issue. It would be helpful to resolve my blocker. What I have done: Created a MAUI app--> have made no changes --> Directly trying to deploy in the android device --> getting the error as Severity Code Description Project File Line Suppression State |
@AnithaRaniT What you need to do: Download this zip file https://github.com/xamarin/xamarin-android-binutils/suites/14588951053/artifacts/826817155 Uncompress it. Again uncompress .7z file. You should then have 4 exe files - llc.exe, lld.exe, llvm-mc.exe, llvm-strip.exe Copy lld.exe and rename the copy ld.exe Go to path C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\binutils\bin\ (That path is for MAUI. For Xamarin, the path is C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Xamarin\Android\binutils\bin\ ) Back up the files in that directory. Close Visual Studio Copy the five new exe files into that directory. Start Visual Studio and build your app again. |
@ilamble I followed all the steps as mentioned above. But still the issue is not fixed yet. Getting a few more error as below: Severity Code Description Project File Line Suppression State C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Common.targets 1987 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Common.targets 1987 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Common.targets 1987 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Common.targets 1987 Steps I followed.
My VS version details as below: Microsoft Visual Studio Professional 2022 Installed Version: Professional Visual C++ 2022 00476-80000-00000-AA633 ADL Tools Service Provider 1.0 ASA Service Provider 1.0 ASP.NET and Web Tools 17.6.326.62524 Azure App Service Tools v3.0.0 17.6.326.62524 Azure Data Lake Tools for Visual Studio 2.6.5000.0 Azure Functions and Web Jobs Tools 17.6.326.62524 Azure Stream Analytics Tools for Visual Studio 2.6.5000.0 C# Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a Common Azure Tools 1.10 Extensibility Message Bus 1.4.21 (main@8f226a8) Microsoft Azure Hive Query Language Service 2.6.5000.0 Microsoft Azure Stream Analytics Language Service 2.6.5000.0 Microsoft Azure Tools for Visual Studio 2.9 Microsoft JVM Debugger 1.0 Mono Debugging for Visual Studio 17.6.41 (790a401) NuGet Package Manager 6.6.0 Razor (ASP.NET Core) 17.6.0.2327201+a6a61fdfa748eaa65aab53dab583276e26af4a3e SQL Server Data Tools 17.6.13.0 StylerPackage Extension 1.0 ToolWindowHostedEditor 1.0 TypeScript Tools 17.0.20329.2001 Visual Basic Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a Visual F# Tools 17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97 Visual Studio IntelliCode 2.2 VisualStudio.DeviceLog 1.0 VisualStudio.Mac 1.0 VSPackage Extension 1.0 Xamarin 17.6.0.251 (d17-6@318364c) Xamarin Designer 17.6.6.0 (remotes/origin/d17-6@cb430751d1) Xamarin Templates 17.6.32 (98c12a2) Xamarin.Android SDK 13.2.0.6 (d17-5/a200af1) Xamarin.iOS and Xamarin.Mac SDK 16.4.0.6 (97731c92c) |
@AnithaRaniT Can you try doing the same in directory (I can see from your error messages that you have a later version of MAUI than I have) |
Thanks @ilamble. It worked :) |
@ilamble, I'm experiencing new errors as follows, Severity Code Description Project File Line Suppression State Error APPX1101 Payload contains two or more files with the same destination path 'Cosmos.CRTCompat.dll'. Source files: Error XA3006 Could not compile native assembly file: typemaps.x86_64.ll |
@grendello - After updating VS to Version 17.7.1, I started getting below errors 3>c:\program files\microsoft visual studio\2022\professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2028,3): error XA3006: Could not compile native assembly file: marshal_methods.x86_64.ll |
@arvindrajachourasiya the workload packs would have been updated during the upgrade. You will probably need to re-apply the "fix" you did earlier for the previous version. But make sure you put the files in the newer pack folders. |
@dellis1972 , In my case, I did the repair, uninstalled and installed freshly with VS version 17.4.3. But still the problem exists. |
Any suggestions? |
"DEP1700: The recipe file "C:\Projects\MauiApp2\MauiApp2\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\MauiApp2.build.appxrecipe" does not exist. You may need to build your project. MauiApp2 Can someone help me with this error in MAUI windows app |
Description
Create .NET MAUI Project. I haven't modified anything. While doing build getting compile time error - Could not compile native assembly file: environment.arm64-v8a.ll
Same issue I have found here and tried given solution still not working -
https://learn.microsoft.com/en-us/answers/questions/1199060/not-able-to-build-net7-0-android-project-in-vs-for?source=docs
Visual Studio -
Microsoft Visual Studio Professional 2022
Version 17.5.4
VisualStudio.17.Release/17.5.4+33530.505
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Professional
ASP.NET and Web Tools 17.5.318.41597
ASP.NET and Web Tools
C# Tools 4.5.2-3.23171.7+d17f741546fad2786cbd6394d08619544e53a36d
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Extensibility Message Bus 1.4.3 (main@2a4517a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.5.9 (11975e6)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.5.2.2316603+9f1b6856460af1e592d387ebef416eadddac453f
Provides languages services for ASP.NET Core Razor.
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.5.0.173 (d17-5@33e727c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.5.3.46 (remotes/origin/d17-5@e4dd80b2bb)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 13.2.0.0 (d17-5/797e2e1)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 6dd9def
Java.Interop: xamarin/java.interop/main@149d70fe
SQLite: xamarin/sqlite@fdc1e34
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9f02d77
Steps to Reproduce
Expected behavior : Getting an error
Actual behavior : Project should build successfully
Link to public reproduction project repository
NA
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: