ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.15k stars 110 forks source link

PlatformNotSupportedException on Linux ARM64 #435

Closed leandroconsiglio closed 8 months ago

leandroconsiglio commented 8 months ago

Hi. I am running a library on Linux on a 64-bit processor without problems. But when I want to run the same library on an ARM64 architecture it is throwing the exception: PlatformNotSupportedException.

This is the stacktrace: ---> System.PlatformNotSupportedException: Operation is not supported on this platform. at IKVM.Runtime.JNI.Trampolines.FunctionTable.CreateInstance() at IKVM.Runtime.JNI.Trampolines.FunctionTable.get_Instance() at IKVM.Runtime.JNI.JNINativeInterface..cctor()

Investigating the code where the exception is occurring I see the following:

https://github.com/ikvmnet/ikvm/blob/7d5aae5a7427bf07b84ef30d90e81dc32cea32a5/src/IKVM.Runtime/JNI/Trampolines/FunctionTable.cs#L64

Is asking if ProcessArchitecture is X64, but it should be Architecture.Arm64. And then the condition is always false and ends up throwing the PlatformNotSupportedException.

Same should happen here for ARM, the ProcessArchitecture should be Architecture.Arm and not X64:

https://github.com/ikvmnet/ikvm/blob/7d5aae5a7427bf07b84ef30d90e81dc32cea32a5/src/IKVM.Runtime/JNI/Trampolines/FunctionTable.cs#L59

Thank you!

wasabii commented 8 months ago

We're about to release 8.7. Probably within a couple days. And this problem should not exist there. Would you mind giving that a test? 8.7.0-pre.3 on nuget.org.

leandroconsiglio commented 8 months ago

You right. I tested with 8.7.0-pre.3 and it doesn't seem to have that problem. I was able to initialize the library correctly. Thank you