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

Veldrid fails to build on iOS #472

Open
frenzibyte opened this issue Dec 16, 2022 · 1 comment
Open

Veldrid fails to build on iOS #472

frenzibyte opened this issue Dec 16, 2022 · 1 comment

Comments

@frenzibyte
Copy link
Contributor

Happens due to Veldrid referencing Vortice.Direct3D11, which depends on SharpGen.Runtime for generating bindings, and that library cannot be AOT'd on iOS.

0>Mono Ahead of Time compiler - compiling assembly /Users/salman/Projects/osu-framework/SampleGame.iOS/obj/iPhone/Debug/net6.0-ios/ios-arm64/linked/SharpGen.Runtime.dll
AOTID 7CA136D1-DC5C-CDE1-6269-4B4A034E7F8B
* Assertion at /Users/runner/work/1/s/src/mono/mono/metadata/custom-attrs.c:599, condition `out_obj' not met


0>Tool /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.11/Sdk/../tools/mono-aot-cross execution started with arguments: --aot=mtriple=arm64-ios,data-outfile=obj/iPhone/Debug/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/System.Drawing.Common.aotdata,static,asmonly,direct-icalls,full,readonly-value=ObjCRuntime.Runtime.Arch=i4/0,soft-debug,dwarfdebug,no-direct-calls,outfile=obj/iPhone/Debug/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/System.Drawing.Common.dll.s --aot= --debug -O=gsharedvt /Users/salman/Projects/osu-framework/SampleGame.iOS/obj/iPhone/Debug/net6.0-ios/ios-arm64/linked/System.Drawing.Common.dll
        
0>/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.0.527/targets/Xamarin.Shared.Sdk.targets(1003,3): Error  : Failed to AOT compile SharpGen.Runtime.dll, the AOT compiler exited with code 134
0>Tool /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.11/Sdk/../tools/mono-aot-cross execution started with arguments: --aot=mtriple=arm64-ios,data-outfile=obj/iPhone/Debug/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/System.Security.Cryptography.Pkcs.aotdata,static,asmonly,direct-icalls,full,readonly-value=ObjCRuntime.Runtime.Arch=i4/0,soft-debug,dwarfdebug,no-direct-calls,outfile=obj/iPhone/Debug/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/System.Security.Cryptography.Pkcs.dll.s --aot= --debug -O=gsharedvt /Users/salman/Projects/osu-framework/SampleGame.iOS/obj/iPhone/Debug/net6.0-ios/ios-arm64/linked/System.Security.Cryptography.Pkcs.dll
        
0>Tool /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.11/Sdk/../tools/mono-aot-cross execution finished (exit code = 134).
        
0>Mono Ahead of Time compiler - compiling assembly /Users/salman/Projects/osu-framework/SampleGame.iOS/obj/iPhone/Debug/net6.0-ios/ios-arm64/linked/SharpGen.Runtime.COM.dll
AOTID A48F61D9-2494-6DF6-EBD4-7824B1850F51
* Assertion at /Users/runner/work/1/s/src/mono/mono/metadata/custom-attrs.c:599, condition `out_obj' not met


0>/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.0.527/targets/Xamarin.Shared.Sdk.targets(1003,3): Error  : Failed to AOT compile SharpGen.Runtime.COM.dll, the AOT compiler exited with code 134

That's a major blocker from using Veldrid on iOS platforms, and there's no way to exclude such libraries manually as far as I've seen.

@frenzibyte
Copy link
Contributor Author

I've worked around this by placing stub assemblies for the affected libraries using the following:

  <Target Name="CopyStubAssemblies" BeforeTargets="_AOTCompile">
    <Copy SourceFiles="@(StubFiles)" DestinationFolder="obj/$(Platform)/$(Configuration)/$(TargetFramework)/$(RuntimeIdentifier)/linked/" />
  </Target>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant