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

Can't Convert jar to dll #517

Open
LxhSama opened this issue Apr 19, 2024 · 14 comments
Open

Can't Convert jar to dll #517

LxhSama opened this issue Apr 19, 2024 · 14 comments

Comments

@LxhSama
Copy link

LxhSama commented Apr 19, 2024

ikvmc -target:library wxbot1.1.jar have error
IKVM.Tools.Importer (8.8.0+Branch.tags-8.8.0.Sha.0dcccd0af21487f20a29138a6a06948503cf8597)
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.8.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58
C:\Users\Administrator\Downloads\IKVM-8.8.0-bin-net8.0\ikvmc\net8.0\win-x64
8.0.4 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 178
at IKVM.Tools.Importer.IkvmImporterInternal.Execute(String[] args) in /_/src/IKVM.Tools.Importer/IkvmImporterInternal.cs:line 112

@wasabii
Copy link
Contributor

wasabii commented Apr 19, 2024

Did you "Make sure the appropriate reference assemblies for the target environment are included?"

@slxdy
Copy link

slxdy commented Apr 21, 2024

Did you "Make sure the appropriate reference assemblies for the target environment are included?"

Can you clarify? What "core library" are we talking about? What "target environment" are we talking about? What are the "appropriate reference assemblies"? Please don't assume that everyone understands how your app works.

@LxhSama
Copy link
Author

LxhSama commented Apr 21, 2024

Did you "Make sure the appropriate reference assemblies for the target environment are included?"

I compiled a utility library using Java 1.8, and then executed the command 'ikvmc -target:library wxbot1.1.jar' via the command line. I used the latest version 8.8 of IKVM.Tools. However, it threw the above error. The JAR file contains dependencies and can be executed correctly. I don't know if what you're saying is about needing me to include something in the Java package.

@wasabii
Copy link
Contributor

wasabii commented Apr 21, 2024

Every assembly that is part of the target framework you are attempting to link to needs to be available to the compiler. That means -reference to everything like System.Private.CoreLib, System.Runtime, etc, out of the .NET SDK for the version you are targeting; or the appropriate reference assemblies for the version of .NET framework you are targeting, need to be specified on the command line.

@slxdy
Copy link

slxdy commented Apr 21, 2024

Can you add an argument like -use-current-clr-libs to make it automatically use the libraries that the compiler itself is using? Would make everything way easier

@wasabii
Copy link
Contributor

wasabii commented Apr 21, 2024

No. You have to pass every assembly to the C# compiler, too. This has been required since .net core was introduced.

Which the build system does. Which is why we recommend IkvmReference.

@LxhSama
Copy link
Author

LxhSama commented Apr 22, 2024

No. You have to pass every assembly to the C# compiler, too. This has been required since .net core was introduced.

Which the build system does. Which is why we recommend IkvmReference.
Does that mean that the Tools approach cannot be used directly and instead, using IkvmReference is recommended?

@wasabii
Copy link
Contributor

wasabii commented Apr 22, 2024

You can use the tools. They are just very hard to use. Same as the csharp compiler these days.

IkvmReference is the only thing mentioned in the README for this reason.

@LxhSama LxhSama closed this as completed Apr 22, 2024
@slxdy
Copy link

slxdy commented Apr 22, 2024

You can use the tools. They are just very hard to use. Same as the csharp compiler these days.

IkvmReference is the only thing mentioned in the README for this reason.

Wait a second, does IKVM actually generate C# code instead of directly building a CIL assembly?

@LxhSama LxhSama reopened this Apr 22, 2024
@wasabii
Copy link
Contributor

wasabii commented Apr 22, 2024

No.....

@slxdy
Copy link

slxdy commented Apr 22, 2024

No.....

But why do you need the system assemblies then? You should only need to know whether youre targeting core or framework

@wasabii
Copy link
Contributor

wasabii commented Apr 22, 2024

Because it needs to find types in them.

@slxdy
Copy link

slxdy commented Apr 22, 2024

Because it needs to find types in them.

You dont actually. Type references can be made from pure names. Actually loading system libraries is just an extra unnecessary step

@wasabii
Copy link
Contributor

wasabii commented Apr 22, 2024

We don't know what assemblies they live in unless we look. Same situation as Roslyn. The compiler isn't hard coded to the location of classes in assemblies, since this is subject to change.

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

3 participants