ikvmnet / ikvm

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

ikvmc macOS: Core library not found. #626

Open Lancelotbronner opened 3 days ago

Lancelotbronner commented 3 days ago

I'm trying to convert a jar to an assembly and, so far, I'm finding the process very difficult.

I'm doing this because the dynamic IkvmReference no longer work as of IKVM 8 on macOS because it uses dynamic code generation which isn't supported.

I haven't found any other docs than the ones at https://ikvm.org/ikvm which don't help with the troubleshooting.

I downloaded the latest tools from Github releases.

Here's my command:

ikvmc ../javaparser-core-3.26.2.jar -nostdlib -target:library -r:"IKVM-8/System.Runtime.dll"

And the resulting error:

IKVM.Tools.Importer (8.10.3+Branch.tags-8.10.3.Sha.d45bebd4fecc49548317667fe412663850b58910)
Copyright © 2024 Jeroen Frijters, Windward Studios, Jerome Haltom, Shad Storhaug

Core library not found. Make sure the appropriate reference assemblies for the target environment are included.

*** COMPILER ERROR ***

IKVM.Tools.Importer, Version=8.10.3.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58
IKVM-8/
8.0.10 64-bit

System.Exception: Exception of type 'System.Exception' was thrown.
   at IKVM.Tools.Importer.StaticCompiler.Init(Boolean nonDeterministicOutput, DebugMode debug, IList`1 libpaths) in /_/src/IKVM.Tools.Importer/StaticCompiler.cs:line 72
   at IKVM.Tools.Importer.IkvmImporterInternal.Compile(String[] args) in /_/src/IKVM.Tools.Importer/IkvmImporterInternal.cs:line 179
   at IKVM.Tools.Importer.IkvmImporterInternal.Execute(String[] args) in /_/src/IKVM.Tools.Importer/IkvmImporterInternal.cs:line 113
wasabii commented 3 days ago

I'm not sure in your reasoning here. Tons of people use IkvmReference on the newest Macs. I have unit tests. And a Mac.

The dynamic code restrictions are in Catalyst and iOS. Neither of which you build from.

Lancelotbronner commented 2 days ago

My reasoning was I updated to net8 and the latest IKVM version and now the project always fails at runtime with a message about dynamic code generation being unavailable for the platform.

This is when compiling for macOS arm64 and running in a .NET 8 console app.

My reference was just the Include, nothing else. Is there something I should add? Are there known incompatibilities of IKVM with certain dotnet configurations?

I looked through the docs and couldn't find any counter-indications. Is there up-to-date documentation anywhere?

wasabii commented 2 days ago

IKVM uses dynamic code generation at runtime. Nothing to do with whether you statically compile your specific assembly or not. So it does not support AOT.

But it will run as a normal .NET app on OSX just fine.