Skip to content

build issue typemaps.x86_64.ll: error: Could not open input file: no such file or directory #8967

Description

@hansmbakker

Android application type

.NET Android (net7.0-android, net8.0-android, etc.)

Affected platform version

VS 2022 17.10 Preview 7

Description

When trying to debug my app, I sometimes get an issue like typemaps.x86_64.ll: error: Could not open input file: no such file or directory.
Another error I got was typemaps.armeabi-v7a.ll: error: Could not open input file: no such file or directory

This happens both in Visual Studio and on the command line using MSBuild.

The build error code is XA3006.

Steps to Reproduce

Not sure, but it is related to debugging on different devices having different processor architectures.

It happens e.g. when I try to deploy to my x86_64 emulator on my development machine after debugging via USB on a physical phone (which has an ARM processor).

Did you find any workaround?

No

Relevant log output

Please see the relevant tail of the logs below. The part before this (building the app) is common to all target devices and is working fine.

Skipping target "_LinkAssembliesNoShrink" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files.
Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateEmptyAndroidRemapNativeCode" because all output files are up-to-date with respect to the input files.
Touching "obj\Debug
et8.0-android\stamp\_GeneratePackageManagerJava.stamp".
Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files.
Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
[llc.EXE stderr] C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.95\tools\binutils\bin\llc.exe: error: C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.95\tools\binutils\bin\llc.exe: typemaps.x86_64.ll: error: Could not open input file: no such file or directory
XA3006: Could not compile native assembly file: typemaps.x86_64.ll

stderr | C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.95\tools\binutils\bin\llc.exe: error: C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.95\tools\binutils\bin\llc.exe: typemaps.x86_64.ll: error: Could not open input file: no such file or directory


Done building project "Anonymized.App.csproj" -- FAILED.
Build FAILED.
2>Deployment failed to Small_Phone_API_34.
2>Deploy failed
========== Build: 1 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========
========== Build completed at 13:32 and took 11,768 seconds ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
========== Deploy completed at 13:32 and took 11,768 seconds ==========

Activity

  1. hansmbakker commented on May 20, 2024

    @hansmbakker
    Author

    @grendello let's discuss the build issue here.

    I recorded a binlog and can share it confidentially (it contains client information).

  2. hansmbakker commented on May 21, 2024

    @hansmbakker
    Author

    The logs are shared with @grendello's Microsoft account via OneDrive

  3. grendello commented on May 22, 2024

    @grendello
    Contributor

    @hansmbakker can you modify the C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.95\tools\Xamarin.Android.Common.targets file and apply the following diff:

    diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
    index 5d81e3f75..5c35118e6 100644
    --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
    +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
    @@ -1443,7 +1443,7 @@ because xbuild doesn't support framework reference assemblies.
     <Target Name="_GenerateJavaStubs"
         DependsOnTargets="$(_GenerateJavaStubsDependsOnTargets);$(BeforeGenerateAndroidManifest)"
         Inputs="@(_AndroidMSBuildAllProjects);@(_ResolvedUserMonoAndroidAssemblies);$(_AndroidManifestAbs);$(_AndroidBuildPropertiesCache);@(AndroidEnvironment);@(LibraryEnvironments)"
    -    Outputs="$(_AndroidStampDirectory)_GenerateJavaStubs.stamp">
    +    Outputs="$(_AndroidStampDirectory)_GenerateJavaStubs.stamp;@(_TypeMapAssemblySource)">
     
       <PropertyGroup>
         <_ManifestOutput Condition=" '$(AndroidManifestMerger)' == 'legacy' ">$(IntermediateOutputPath)android\AndroidManifest.xml</_ManifestOutput>

    And see if that fixes the issue?

  4. added
    need-infoIssues that need more information from the author.
    and removed
    needs-triageIssues that need to be assigned.
    on May 23, 2024
  5. hansmbakker commented on May 23, 2024

    @hansmbakker
    Author

    I'm off until Monday and will reply when I have a chance to do it

  6. added
    need-attentionA xamarin-android contributor needs to review
    and removed
    need-infoIssues that need more information from the author.
    on May 23, 2024
  7. hansmbakker commented on May 24, 2024

    @hansmbakker
    Author

    @grendello I tried your change and it seems to help. I had to restart Visual Studio before it picked it up.

    I updated the reproduction steps - it had something to do with switching debugging between devices that have different architectures.

    Please note that xamarin/Xamarin.Forms#15719 and dotnet/maui#14531 (comment) seem to be related.

  8. dezryth commented on May 25, 2024

    @dezryth

    Just popping in to say I'm getting this error too, but don't think I have anything helpful to add. Let me know if there is something I could provide to assist though.

  9. dezryth commented on May 26, 2024

    @dezryth

    @grendello I tried the change as well and it worked for me. I did not have to restart Visual Studio.

  10. 13 remaining items

  11. hansmbakker commented on Jun 28, 2024

    @hansmbakker
    Author

    For me it seemed to happen when switching not between platforms per se (I did not try building for windows or iOS) but switching between targets devices.

    I was switching between different android phones - two physical and one emulator. There were different processor architectures.

  12. pjt33 commented on Jul 10, 2024

    @pjt33

    For all of those hitting this issue (and for whom the fix worked) it would be really nice to figure out what is deleting these files in the first place.

    I think it's not copying them in the first place. If I rebuild the basic template project then the only .ll files copied into obj/Debug/net8.0-android/android/ are .arm64-v8a.ll files. When I then try to debug on an x86_x64 emulator, it copies the .x86_x64.ll versions of all except typemaps. However, the fix doesn't work for me so maybe there are multiple issues at play here.

    Edit: a workaround for me for development is to add <AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi> to the csproj, but I suspect that I won't want that when I come to compile a bundle for release.

  13. dellis1972 commented on Jul 10, 2024

    @dellis1972
    Contributor

    The reason only the x86.64.ll file is used when debugging is we detect the device abi which you are debugging agsinst and only build for that abi. This is different from release packages where we build for all the selected abis.

  14. ziomek64 commented on Jul 16, 2024

    @ziomek64

    For all of those hitting this issue (and for whom the fix worked) it would be really nice to figure out what is deleting these files in the first place.

    I think it's not copying them in the first place. If I rebuild the basic template project then the only .ll files copied into obj/Debug/net8.0-android/android/ are .arm64-v8a.ll files. When I then try to debug on an x86_x64 emulator, it copies the .x86_x64.ll versions of all except typemaps. However, the fix doesn't work for me so maybe there are multiple issues at play here.

    Edit: a workaround for me for development is to add <AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi> to the csproj, but I suspect that I won't want that when I come to compile a bundle for release.

    This workaround worked for me

  15. jonathanpeppers commented on Jul 31, 2024

    @jonathanpeppers
    Member

    Does someone know the repro steps to cause this problem?

    I thought that this would cause it inside Visual Studio:

    • F5 to an arm64 device
    • F5 to an x86_64 emulator

    But that seems to work fine.

  16. PredatH0r commented on Aug 1, 2024

    @PredatH0r

    For me it happened just now the first time after switching from the Android emulator (on x64) to a Samsung device (arm64) and then back again to the emulator.
    The fix now allows me to run my app in the emulator again.

  17. zijianhuang commented on Sep 3, 2024

    @zijianhuang

    @grendello has given a good answer about modifying file in tools\Xamarin.Android.Common.targets

    The problem has come back to me upon VS 17.11.2, now go to the targets file in
    C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools

    Not sure if MS should fix this?

  18. grendello commented on Sep 3, 2024

    @grendello
    Contributor

    @zijianhuang it's fixed in #9174

  19. locked and limited conversation to collaborators on Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions