Skip to content

Conversation

jonathanpeppers
Copy link
Member

Fixes: dotnet/runtime#64269

An F# test was failing in AOT builds with:

Microsoft.Android.Sdk.Aot.targets(74,5): Precompiling failed for C:\src\xamarin-android\bin\TestDebug\temp\BuildBasicApplicationFSharpTrue\obj\Release\android-arm\aot-in\FSharp.Core.resources.dll.
AOT of image obj\Release\android-arm\aot-in\FSharp.Core.resources.dll failed.
Mono Ahead of Time compiler - compiling assembly C:\src\xamarin-android\bin\TestDebug\temp\BuildBasicApplicationFSharpTrue\obj\Release\android-arm\aot-in\FSharp.Core.resources.dll
AOTID 302CA46D-4000-DCAD-1A9F-642D849470DE
Using profile data file 'C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\targets\dotnet.aotprofile'
Added 0 methods from profile.
Compiled: 0/0
Executing the native assembler: "C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\tools\binutils\arm-linux-androideabi-as"   -mfpu=vfp3 -o obj\Release\android-arm\aot\armeabi-v7a\FSharp.Core.resources\temp.s.o obj\Release\android-arm\aot\armeabi-v7a\FSharp.Core.resources\temp.s
Executing the native linker: "C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\tools\binutils\arm-linux-androideabi-ld" -Bsymbolic -shared -o obj\Release\android-arm\aot\FSharp.Core.resources.dll.so.tmp  obj\Release\android-arm\aot\armeabi-v7a\FSharp.Core.resources\temp.s.o
Stripping the binary: "C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\tools\binutils\arm-linux-androideabi-strip" --strip-symbol=\$a --strip-symbol=\$d obj\Release\android-arm\aot\FSharp.Core.resources.dll.so.tmp [C:\src\xamarin-android\bin\TestDebug\temp\BuildBasicApplicationFSharpTrue\UnnamedProject.fsproj]

It turns out we shouldn't be passing satellite assemblies to the AOT
compiler, they appear to be included in @(ResolvedFileToPublish):

<ItemGroup>
  <_AndroidAotInputs Include="@(ResolvedFileToPublish)" Condition=" '%(Extension)' == '.dll' " />
</ItemGroup>

Viewing these assemblies, I see the metadata
%(ResolvedFileToPublish.AssetType) is equal to resources. I think
we can simply check for this and ignore these files.

The F# test I parameterized to include an AOT build.

I also removed a TODO on F# tests, since this is fixed now:

dotnet/linker#1448

Fixes: dotnet/runtime#64269

An F# test was failing in AOT builds with:

    Microsoft.Android.Sdk.Aot.targets(74,5): Precompiling failed for C:\src\xamarin-android\bin\TestDebug\temp\BuildBasicApplicationFSharpTrue\obj\Release\android-arm\aot-in\FSharp.Core.resources.dll.
    AOT of image obj\Release\android-arm\aot-in\FSharp.Core.resources.dll failed.
    Mono Ahead of Time compiler - compiling assembly C:\src\xamarin-android\bin\TestDebug\temp\BuildBasicApplicationFSharpTrue\obj\Release\android-arm\aot-in\FSharp.Core.resources.dll
    AOTID 302CA46D-4000-DCAD-1A9F-642D849470DE
    Using profile data file 'C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\targets\dotnet.aotprofile'
    Added 0 methods from profile.
    Compiled: 0/0
    Executing the native assembler: "C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\tools\binutils\arm-linux-androideabi-as"   -mfpu=vfp3 -o obj\Release\android-arm\aot\armeabi-v7a\FSharp.Core.resources\temp.s.o obj\Release\android-arm\aot\armeabi-v7a\FSharp.Core.resources\temp.s
    Executing the native linker: "C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\tools\binutils\arm-linux-androideabi-ld" -Bsymbolic -shared -o obj\Release\android-arm\aot\FSharp.Core.resources.dll.so.tmp  obj\Release\android-arm\aot\armeabi-v7a\FSharp.Core.resources\temp.s.o
    Stripping the binary: "C:\Program Files\dotnet\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.dotnet-release-aot-by-default.36\tools\binutils\arm-linux-androideabi-strip" --strip-symbol=\$a --strip-symbol=\$d obj\Release\android-arm\aot\FSharp.Core.resources.dll.so.tmp [C:\src\xamarin-android\bin\TestDebug\temp\BuildBasicApplicationFSharpTrue\UnnamedProject.fsproj]

It turns out we shouldn't be passing satellite assemblies to the AOT
compiler, they appear to be included in `@(ResolvedFileToPublish)`:

    <ItemGroup>
      <_AndroidAotInputs Include="@(ResolvedFileToPublish)" Condition=" '%(Extension)' == '.dll' " />
    </ItemGroup>

Viewing these assemblies, I see the metadata
`%(ResolvedFileToPublish.AssetType)` is equal to `resources`. I think
we can simply check for this and ignore these files.

The F# test I parameterized to include an AOT build.

I also removed a `TODO` on F# tests, since this is fixed now:

dotnet/linker#1448
@jonathanpeppers jonathanpeppers force-pushed the aot-satellite-assemblies branch from 2bada93 to 06c144b Compare January 31, 2022 16:59
@jonathanpeppers jonathanpeppers merged commit 84f31d5 into dotnet:main Jan 31, 2022
@jonathanpeppers jonathanpeppers deleted the aot-satellite-assemblies branch January 31, 2022 19:28
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<MonoAOTCompiler/> fails on F# projects due to satellite assemblies

2 participants