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

Windows ARM64 Support (Runtime/SDK) (Core) #197

Closed
wasabii opened this issue Oct 29, 2022 · 27 comments
Closed

Windows ARM64 Support (Runtime/SDK) (Core) #197

wasabii opened this issue Oct 29, 2022 · 27 comments
Labels
enhancement New feature or request

Comments

@wasabii
Copy link
Contributor

wasabii commented Oct 29, 2022

This would be nice to add, and should be no big deal.

[EDIT]

It is.

@wasabii wasabii added the enhancement New feature or request label Oct 29, 2022
@AliveDevil
Copy link
Collaborator

AliveDevil commented Oct 29, 2022

Take into account that e.g. BouncyCastle with the SunEC Provider requires sunec and msvcp120 which is unavailable for arm64. So … mixed bag here.

@wasabii
Copy link
Contributor Author

wasabii commented Oct 29, 2022

We don't make use of any of the native openjdk bits.

@AliveDevil
Copy link
Collaborator

Phrased differently: IKVM won’t be 100% arm64 compatible, because client libraries like BouncyCastle, which depend on (JDK8) sunmscapi, won‘t work on arm64, due to ancient dependencies and missing platform libraries.

@wasabii
Copy link
Contributor Author

wasabii commented Oct 29, 2022

Ahh. If so they don't work now.

@wasabii
Copy link
Contributor Author

wasabii commented Oct 30, 2022

So the hardest part of this is going to be adding Windows ARM64 PE support into IKVM.Reflection. Thing basically has it's own PEWriter, and includes a startup stub for executables, which is just an array of machine code.... obtained from somewhere. So will need an arm64 version of that. And a bunch of other stuff, like reallocation offsets, heap sizes, etc.

Probably should defer this guy until we just replace IKVM.Reflection with System.Reflection.Metadata.

@wasabii wasabii changed the title Windows ARM64 support Windows ARM64 Support (Runtime/SDK) Nov 17, 2022
@paulirwin
Copy link

+1, looking forward to this as a Windows on Arm (Arm64) user. I'm going to take a stab at it but I currently have low confidence that I'll be successful 😊

@wasabii
Copy link
Contributor Author

wasabii commented Mar 14, 2023

Okay.

So my thinking on this hasn't changed since my last comment. There's not a whole lot of reason to struggle with updating IKVM.Reflection for this. Effort should instead be put into removing IKVM.Reflection, and emitting assembly data through SRM.Ecma335.

This has the added benefit of allowing us to likely remove a good deal of #IFDEF statements that conditionalize System.Type.

There's a bit of complication here, since IKVM shares the same code for runtime code generation and static code generation. And at runtime, we have to use DynamicAssembly, since we're compiling individual types on the fly. So, we need to use SR at Runtime, and SRM.Ecma335 at static time. And these aren't compatible APIs.

One good thing is I think we can just switch to System.Type all throughout, since SRM provides MetadataLoadContext, which provides System.Type instances. But, all of the metadata building is going to have to have two paths. So, I think it makes sense to abstract that out through some interface. And then for runtime compilation, provide an implementation that makes use of SR. And for static time, provide an implementation that uses SRM.Ecma335.

@wasabii
Copy link
Contributor Author

wasabii commented Mar 14, 2023

#59

@wasabii
Copy link
Contributor Author

wasabii commented Mar 14, 2023

#58

@paulirwin
Copy link

I was familiarizing myself a little with the code today, and noticed the .NET FX 4.6.1 build, and of course only 4.8.1 is supported for ARM64.

After the work is completed that you mention above, does this mean that 4.8.1 would need to be added as an additional target framework, while ignoring 4.6.1 for win-arm64? Or just ignore .NET FX entirely on win-arm64 and go straight to i.e. .NET 6?

@wasabii
Copy link
Contributor Author

wasabii commented Mar 15, 2023

There's a lot of things.

First, the executables will need to have an additional NET481 target for ARM64. 'ikvmc' will need to be capable of generating such things from JAR files. 'ikvmc' right now is incapable of generating Framework executables for ARM64.

Second, for Core, Core 3.1 doesn't support ARM64 at all. So for that we'd need to support the executables running in .NET 5 or above. Which means we'd need to support a drop for .NET 5.0.

@martin-honnen
Copy link

Reading through this it sounds as if neither for .NET framework nor for .NET Core IKVM on Windows supports ARM64. Why does https://github.com/ikvmnet/ikvm say: "Windows x86/x64/ARM/ARM64"?

@wasabii
Copy link
Contributor Author

wasabii commented May 17, 2023

Because it'll run on it. We can't build the executables though: so no ikvmc, etc. No tools or build environment.

But the apps you make that use IKVM will run on ARM64.

@martin-honnen
Copy link

So trying a project IKVM.NET.Sdk/8.5.0 with a build configuration ARM64 is expected not to work and show errors like e.g. C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : *** INTERNAL COMPILER ERROR ***?

1>------ Erstellen gestartet: Projekt: SaxonHE10Java, Konfiguration: Release ARM64 ------
1>SaxonHE10Java -> C:\Users\marti\source\repos\SaxonHE10Net\SaxonHE10Java\bin\ARM64\Release\netcoreapp3.1\SaxonHE10Java.dll
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\mscorlib.dll" has the same identity "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Users\marti\.nuget\packages\system.buffers\4.5.1\ref\net45\System.Buffers.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Buffers.dll" has the same identity "System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Core.dll" has the same identity "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Data.dll" has the same identity "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.dll" has the same identity "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Drawing.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Drawing.dll" has the same identity "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.IO.Compression.FileSystem.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.IO.Compression.FileSystem.dll" has the same identity "System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Numerics.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Numerics.dll" has the same identity "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Users\marti\.nuget\packages\system.numerics.vectors\4.5.0\ref\net46\System.Numerics.Vectors.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Numerics.Vectors.dll" has the same identity "System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Runtime.Serialization.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Runtime.Serialization.dll" has the same identity "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Users\marti\.nuget\packages\system.valuetuple\4.5.0\ref\net461\System.ValueTuple.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ValueTuple.dll" has the same identity "System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Xml.dll" has the same identity "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Xml.Linq.dll" has the same identity "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ComponentModel.Annotations.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ComponentModel.Annotations.dll" has the same identity "System.ComponentModel.Annotations, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Emit.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Reflection.Emit.dll" has the same identity "System.Reflection.Emit, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Emit.ILGeneration.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Reflection.Emit.ILGeneration.dll" has the same identity "System.Reflection.Emit.ILGeneration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Emit.Lightweight.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Reflection.Emit.Lightweight.dll" has the same identity "System.Reflection.Emit.Lightweight, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.InteropServices.WindowsRuntime.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.Runtime.InteropServices.WindowsRuntime.dll" has the same identity "System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Duplex.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ServiceModel.Duplex.dll" has the same identity "System.ServiceModel.Duplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Http.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ServiceModel.Http.dll" has the same identity "System.ServiceModel.Http, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.NetTcp.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ServiceModel.NetTcp.dll" has the same identity "System.ServiceModel.NetTcp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Primitives.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ServiceModel.Primitives.dll" has the same identity "System.ServiceModel.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0127: Assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Security.dll" is ignored as previously loaded assembly "C:\Users\marti\.nuget\packages\ikvm.msbuild.tools.runtime.win7-x64\8.5.0\ikvmc\net461\win7-x64\refs\System.ServiceModel.Security.dll" has the same identity "System.ServiceModel.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ComponentModel.Annotations, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Reflection.Emit, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Reflection.Emit.ILGeneration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Reflection.Emit.Lightweight, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ServiceModel.Duplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ServiceModel.Http, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ServiceModel.NetTcp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ServiceModel.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : warning IKVMC0132: Duplicate assembly reference "System.ServiceModel.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : *** INTERNAL COMPILER ERROR ***
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : IKVM.Tools.Importer, Version=8.5.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : 4.0.30319.42000 64-bit
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning : System.NotSupportedException: Die angegebene Methode wird nicht unterstützt.
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Reflection.Writer.TextSection.get_StartupStubLength()
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Reflection.Writer.TextSection.get_Length()
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Reflection.Writer.ModuleWriter.WriteModuleImpl(StrongNameKeyPair keyPair, Byte[] publicKey, ModuleBuilder moduleBuilder, PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine, ResourceSection resources, Int32 entryPointToken, Stream stream)
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Reflection.Writer.ModuleWriter.WriteModule(StrongNameKeyPair keyPair, Byte[] publicKey, ModuleBuilder moduleBuilder, PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine, ResourceSection resources, Int32 entryPointToken, Stream stream)
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Reflection.Emit.AssemblyBuilder.SaveImpl(String assemblyFileName, Stream streamOrNull, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Tools.Importer.CompilerClassLoader.Save()
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Tools.Importer.CompilerClassLoader.Compile(String runtimeAssembly, List`1 optionsList)
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Tools.Importer.IkvmImporterInternal.Compile(String[] args)
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): warning :    bei IKVM.Tools.Importer.IkvmImporterInternal.Execute(String[] args)
1>C:\Users\marti\.nuget\packages\ikvm.net.sdk\8.5.0\targets\IKVM.Java.Core.Tasks.targets(112,9): error MSB4181: Die Aufgabe "IkvmCompiler" hat FALSE zurückgegeben, jedoch keinen Fehler protokolliert.
1>Die Erstellung des Projekts "SaxonHE10Java.msbuildproj" ist abgeschlossen -- FEHLER.

@wasabii
Copy link
Contributor Author

wasabii commented May 17, 2023

What exactly are you trying to build there?

@wasabii
Copy link
Contributor Author

wasabii commented May 17, 2023

Hmm. Ok. I get it. Targeting framework. Which requires the tool chain to emit a PE.

It will be fine on Core, which doesn't require that. But also if you just build a platform independent library and only reference it from a platform dependent assembly.

@martin-honnen
Copy link

I managed to use that IKVM.NET.Sdk/8.5.0 with the default Any CPU configuration to compile the Saxon HE 10.9 Java sources to .NET (the allowed target frameworks <TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>).

Now I am experimenting whether the lib from that project can be used to build Windows ARM64 versions of Saxon's C#/.NET command line tools Transform and Query and therefore used a configuration for ARM64. Then VS decides it also has to do use the ARM64 config to rebuild the IKVM.NET.Sdk/8.5.0, it seems, and gives the error.

But I am not sure I have grasped how far a platform independent build will get me, probably better to see later this day when I have access to an ARM64 machine whether the code runs without experimenting with all the configuration switches.

@wasabii
Copy link
Contributor Author

wasabii commented May 17, 2023

So here's the background on this:

In order to generate .exe files, you have to emit Windows PE files. Portable Executables. That's native code. With headers, tables, and all that entails. IKVM has it's own entire implementation of doing this, in IKVM.Reflection. IKVM.Reflection is a nearly complete copy of System.Reflection. Including System.Reflection.Emit. From 10 years ago.

The problem is nobody ever added the ARM64 PE support to IKVM.Reflection.

So, consequently, ikvmc cannot emit ARM64 PE files.

This doesn't matter in Core, because PE file generation has been removed from the toolchain. Instead, apphost.exe is precompiled and distributed by MS for the available platforms, and the SDK just copies it into output. And the toolchain only has to produce a .dll file. So, when targeting Core, everybody is really just using the exact same apphost.exe file, copied and renamed. IKVM doesn't have to do anything.

So, narrowly, this restriction we have applies to generating PE files for Windows for ARM64. Anyway you can avoid that avoids the issue.

Easy option: use IKVM.NET.Sdk to generate a library instead. And then just call that library from a standard C# project which can generate an ARM64 executable.

Or use Core, where none of that matters.

@martin-honnen
Copy link

Thanks,

it indeed seems VS 2022 Windows let's me publish .NET 6 or 7 executables for the different operating system and architecture (e.g. amd64 vs arm64) options.

I will need to check later whether the Windows 11 x64/amd64 machine really creates stuff for a Mac with OSX and ARM 64 or a Linux ARM 64. That looks all promising currently, just need to check later whether it runs on the target system(s).

@wasabii
Copy link
Contributor Author

wasabii commented May 17, 2023

It does. We don't use Configuration any more though. We used RIDs

@martin-honnen
Copy link

martin-honnen commented May 21, 2023

I have now tested some of the VS publications on some different machines and other than the lack of OSX M1/M2 (arm64) and the lack of .NET framework arm64 support it seems to work fine.

Looking at the published files, I however wonder, whether, if I wanted to create installers or a zip of files for a certain platform, for every platform there needs to be a whole lot of ikvm subdirectories e.g. if I publish for e.g. Linux arm64 and net6.0 Visual Studio creates a folder named ikvm that contains several subfolders like linux-arm, linux-arm64, linux-x64 and even osx-x64 and four subfolders for Windows i.e. win7-x64, win7-x86, win10-arm64 and win81-arm.

Am I right to assume that any .net 6 app I want to use on or package for Linux and arm64 only needs that linux-arm64 subfolder?

@wasabii
Copy link
Contributor Author

wasabii commented May 21, 2023

You are correct. We need to fix the build scripts to only publish the appropriate folder. But it's not super easy because we need to trace compatibility between RIDs. So right now we just include them all.

For instance, if you publish RID ubuntu-20.04-x64, we need to include linux-x64. Hard to determine.

@wasabii
Copy link
Contributor Author

wasabii commented Oct 11, 2023

The real issue here hasn't changed. Still can't emit .exe files for AMR64. But, as to @martin-honnen's mention of the ikvm/ image directory: in 8.7, we rewrote the IKVM.Image logic to better detect the target platform (by navigating the RID graph), to determine the appropriate RID of the image to emit to the publish directory, and to remove instances where downstream library files compiled without RID being included into upstream executables with RID were including unnecessary files. publish, now, should only include the single ikvm/ image for the target platform (unless doing a platform independent publish, where everything is still included).

@wasabii
Copy link
Contributor Author

wasabii commented Oct 20, 2023

8.7.0 is going to add support for the SDK and the Runtime for .NET Core for Windows ARM64. Which is a pretty big advancement, I think. Still no Framework, because of our lack PE support. Going to duplicate this issue for Framework, and allow this one to close as part of 8.7.0.

@wasabii wasabii changed the title Windows ARM64 Support (Runtime/SDK) Windows ARM64 Support (Runtime/SDK) (Core) Oct 20, 2023
@martin-honnen
Copy link

Great, is that SDK and runtime support already in the preview 2 of 8.7? I might have missed that being busy testing the MacOs ARM64 support.

@wasabii
Copy link
Contributor Author

wasabii commented Oct 20, 2023

It will be in the next build. I'll do one more preview.

@martin-honnen
Copy link

@wasabii , I am curious (and don't have always access to that architecture to just test), does the preview 3 of 8.7 now support .NET 6 on ARM64 for the SDK? Or is that only coming in the final 8.7 release?

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

No branches or pull requests

4 participants