Xamarin-macios: Could not AOT the assembly (FSharp.Core.dll)

Created on 8 Dec 2020  路  3Comments  路  Source: xamarin/xamarin-macios

Steps to Reproduce

$ msbuild "/target:Build" "/p:Configuration=Release" "/p:Platform=iPhone" "/p:ArchiveOnBuild=true" "/p:BuildIpa=true"

Expected Behavior

The build completes successfully and generates an archive.

Actual Behavior

It fails with the following error for both an iOS target:

MTOUCH : error MT3001: Could not AOT the assembly '/Users/nicklee/Documents/Development/<redacted>/obj/iPhone/QA/mtouch-cache/3-Build/FSharp.Core.dll' [/Users/nicklee/Documents/Development/<redacted>/<redacted>.iOS.csproj]

and a watchOS target:

MTOUCH : error MT3001: Could not AOT the assembly '/Users/nicklee/Documents/Development/<redacted>/obj/iPhone/QA/mtouch-cache/3-Build/FSharp.Core.dll' [/Users/nicklee/Documents/Development/<redacted>/<redacted>.WatchOSExtension.csproj

Environment

=== Visual Studio Enterprise 2019 for Mac ===

Version 8.8.3 (build 16)
Installation UUID: 9dd80479-a6c3-48b1-a1e9-315d6bf319c7
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000107

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.107 (2020-02/a22ed3f094e) (64-bit)
    Package version: 612000107

=== Roslyn (Language Service) ===

3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.100/Sdks
SDK Versions:
    5.0.100
    3.1.404
    3.1.403
    3.1.402
    3.1.401
    3.0.103
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    5.0.0
    3.1.10
    3.1.9
    3.1.8
    3.1.7
    3.0.3
    2.1.23
    2.1.22
    2.1.21

=== .NET Core 3.1 SDK ===

SDK: 3.1.404

=== Xamarin.Profiler ===

Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin Designer ===

Version: 16.8.0.507
Hash: e87b24884
Branch: remotes/origin/d16-8
Build date: 2020-10-29 00:31:38 UTC

=== Xamarin.Android ===

Version: 11.1.0.17 (Visual Studio Enterprise)
Commit: xamarin-android/d16-8/c0e2b8e
Android SDK: /Users/nicklee/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: be2226b
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/nicklee/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.8.0.32
Hash: 01a7774
Branch: remotes/origin/d16-8
Build date: 2020-10-13 23:32:30 UTC

=== Android Device Manager ===

Version: 16.8.0.45
Hash: fc0af5f
Branch: remotes/origin/d16-8
Build date: 2020-10-13 23:32:54 UTC

=== Apple Developer Tools ===

Xcode 12.2 (17535)
Build 12B45b

=== Xamarin.Mac ===

Version: 7.0.0.15 (Visual Studio Enterprise)
Hash: 87a1b18d8
Branch: d16-8
Build date: 2020-11-16 21:39:40-0500

=== Xamarin.iOS ===

Version: 14.6.0.15 (Visual Studio Enterprise)
Hash: 87a1b18d8
Branch: d16-8
Build date: 2020-11-16 21:39:41-0500

=== Build Information ===

Release ID: 808030016
Git revision: cc6375d2fdcc1b42532e551e24ce650eaca1ae45
Build date: 2020-11-25 13:16:20-05
Build branch: release-8.8
Xamarin extensions: cc6375d2fdcc1b42532e551e24ce650eaca1ae45

=== Operating System ===

Mac OS X 10.15.6
Darwin 19.6.0 Darwin Kernel Version 19.6.0
    Thu Jun 18 20:49:00 PDT 2020
    root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

Build Logs

When I try to AOT the file manually, it appears to succeed?

$ mono --aot /Users/nicklee/Documents/Development/<redacted>/<redacted>.iOS/obj/iPhone/QA/mtouch-cache/3-Build/FSharp.Core.dll

Mono Ahead of Time compiler - compiling assembly /Users/nicklee/Documents/Development/<redacted>/<redacted>.iOS/obj/iPhone/QA/mtouch-cache/3-Build/FSharp.Core.dll
AOTID 931355BF-4385-955A-825D-7F4C043BBB70
Compiled: 8389/8389
Executing the native assembler: "clang"  -c -x assembler -o /var/folders/n3/7ztz47rs1md7t3l5my18kjd40000gp/T/mono_aot_afyGo7.o /var/folders/n3/7ztz47rs1md7t3l5my18kjd40000gp/T/mono_aot_afyGo7
Executing the native linker: clang --shared -o /Users/nicklee/Documents/Development/<redacted>/<redacted>.iOS/obj/iPhone/QA/mtouch-cache/3-Build/FSharp.Core.dll.dylib.tmp  /var/folders/n3/7ztz47rs1md7t3l5my18kjd40000gp/T/mono_aot_afyGo7.o  -Wl,-install_name,FSharp.Core.dll.dylib
Executing dsymutil: dsymutil "/Users/nicklee/Documents/Development/<redacted>/<redacted>.iOS/obj/iPhone/QA/mtouch-cache/3-Build/FSharp.Core.dll.dylib"
JIT time: 876 ms, Generation time: 574 ms, Assembly+Link time: 3351 ms.
bug iOS

Most helpful comment

If anyone else stumbles upon this, I was able to get past this by manually specifying F# Core 4.7.2 in my .fsproj file.

Doing it in Rider / Visual Studio didn't work. I had to manually edit the project file.

<ItemGroup>
    <PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>

All 3 comments

I found this additional error in the build log:

AOT Compilation exited with code 134, command:
  MONO_PATH=/<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/3-Build /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/bin/arm64-darwin-mono-sgen --debug --llvm -O=gsharedvt -O=-float32 --aot=mtriple=arm64-ios,data-outfile=/<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/arm64/FSharp.Core.aotdata.arm64,static,asmonly,direct-icalls,full,nodebug,dwarfdebug,msym-dir=/<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/3-Build/Msym,llvm-path=/Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/LLVM/bin/,outfile=/<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/arm64/FSharp.Core.dll.s,llvm-outfile=/<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/arm64/FSharp.Core.dll-llvm.o /<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/3-Build/FSharp.Core.dll
  Mono Ahead of Time compiler - compiling assembly /<home>/src/<redacted>.iOS/obj/iPhone/Release/mtouch-cache/3-Build/FSharp.Core.dll
  AOTID D200AB85-42B5-DE60-3C76-65EAAAD039FD
  unknown opcode float_conv_to_i in mono_arch_output_basic_block()

  * Assertion: should not be reached at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/mini-arm64.c:4688

So it's a bug with mono?

Yes, this has been fixed in mono https://github.com/mono/mono/commit/ac596375c762c6b8dbe3c802f0ce626004eab51c this fix should be part of our next preview release, I'll keep the issue open for now.

If anyone else stumbles upon this, I was able to get past this by manually specifying F# Core 4.7.2 in my .fsproj file.

Doing it in Rider / Visual Studio didn't work. I had to manually edit the project file.

<ItemGroup>
    <PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>
Was this page helpful?
0 / 5 - 0 ratings