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

System.IO.FileNotFoundException: netstandard in ikvmc execution #74

Closed
gglyggly opened this issue Jun 7, 2022 · 9 comments
Closed

System.IO.FileNotFoundException: netstandard in ikvmc execution #74

gglyggly opened this issue Jun 7, 2022 · 9 comments

Comments

@gglyggly
Copy link

gglyggly commented Jun 7, 2022

Hi

Tool version: IKVM-8.2.0-prerelease.809-tools

I used the ikvmc tool to convert jar to dll as the framework version, with below issue:

C:\Downloads\IKVM-8.2.0-prerelease.809-tools-netcoreapp3.1-win7-x64>ikvmc -out:lm.dll lm.jar
IKVM.NET Compiler (8.2.0-prerelease.809)
Copyright c 2022 Jeroen Frijters, Windward Studios, Jerome Haltom, Shad Storhaug

*** INTERNAL COMPILER ERROR ***

PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE

ikvmc, Version=8.2.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58
C:\Downloads\IKVM-8.2.0-prerelease.809-tools-netcoreapp3.1-win7-x64
3.1.25 64-bit

System.IO.FileNotFoundException: netstandard
at IKVM.Reflection.Universe.Load(String refname, Module requestingModule, Boolean throwOnError) in D:\a\ikvm\ikvm\IKVM.Reflection\Universe.cs:line 828
at IKVM.Internal.AssemblyResolver.Init(Universe universe, Boolean nostdlib, IList1 references, IList1 userLibPaths) in D:\a\ikvm\ikvm\ikvmc\IKVM\Internal\AssemblyResolver.cs:line 93
at ikvmc.IkvmcCompiler.Compile(String[] args) in D:\a\ikvm\ikvm\ikvmc\IkvmcCompiler.cs:line 178
at ikvmc.IkvmcCompiler.Main(String[] args) in D:\a\ikvm\ikvm\ikvmc\IkvmcCompiler.cs:line 112

image

@NightOwl888
Copy link
Contributor

I discovered the solution to this here.

To prevent it from searching for netstandard.dll, you must use the -nostdlib option and -r:<ikvmtools>/refs/*.dll or -reference:<ikvmtools>/refs/*.dll, where <ikvmtools> is the path to ikvmc. This will build an assembly that targets netcoreapp3.1 (which should also run on an app that targets net5.0 or net6.0).

ikvmc -out:log4j.dll F:\Users\shad\Downloads\log4j-core-2.17.2.jar -nostdlib -r:F:\Users\shad\Downloads\IKVM-8.2.0-prerelease.809-tools-netcoreapp3.1-win7-x64\refs\*.dll

@gglyggly
Copy link
Author

gglyggly commented Jun 8, 2022

Great, it worked, thanks so much!
BTW, when will it become formal one rather than prerelease?

@wasabii
Copy link
Contributor

wasabii commented Jun 10, 2022

@gglyggly I hoped to let people try it out for a couple releases and expose the more obvious bugs before releasing. So I'd give it another 2 weeks minimum.

There are a few issues that I do think are blockers so far. The -nostdlib thing, I think, needs to be resolved first.

@Loffe
Copy link

Loffe commented Sep 13, 2022

I also ran into this problem, however adding -nostdlib did not solve the issue.

I have previously used IKVM from Windward (version 8.5.0.2) and have a build script (in Gradle) calling ikvmc.exe directly. I prefer this approach since I want to understand the details of translating a java library to .NET.

Without -stdlib i get the same error:

IKVM.NET Compiler (8.2.1+Branch.main.Sha.e85684966cf595d7942d6930fda9c27d23b509e1)
Copyright c 2022 Jeroen Frijters, Windward Studios, Jerome Haltom, Shad Storhaug


*** INTERNAL COMPILER ERROR ***

PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE

ikvmc, Version=8.2.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58
C:\Users\eloffer\Downloads\IKVM-8.2.1-tools-ikvmc-netcoreapp3.1\win7-x64\
3.1.27 64-bit

System.IO.FileNotFoundException: netstandard
   at IKVM.Reflection.Universe.Load(String refname, Module requestingModule, Boolean throwOnError) in D:\a\ikvm\ikvm\src\IKVM.Reflection\Universe.cs:line 789
   at IKVM.Internal.AssemblyResolver.Init(Universe universe, Boolean nostdlib, IList`1 references, IList`1 userLibPaths) in D:\a\ikvm\ikvm\src\ikvmc\IKVM\Internal\AssemblyResolver.cs:line 93
   at ikvmc.IkvmcCompiler.Compile(String[] args) in D:\a\ikvm\ikvm\src\ikvmc\IkvmcCompiler.cs:line 178
   at ikvmc.IkvmcCompiler.Main(String[] args) in D:\a\ikvm\ikvm\src\ikvmc\IkvmcCompiler.cs:line 112

If I add -nostdlib -reference:C:/Users/eloffer/Downloads/IKVM-8.2.1-tools-ikvmc-netcoreapp3.1/win7-x64/refs/*.dll I get a similar but not identical error:

IKVM.NET Compiler (8.2.1+Branch.main.Sha.e85684966cf595d7942d6930fda9c27d23b509e1)
Copyright c 2022 Jeroen Frijters, Windward Studios, Jerome Haltom, Shad Storhaug

Error: unable to find 'netstandard.dll'.

Any idea what I am missing?

@wasabii
Copy link
Contributor

wasabii commented Sep 13, 2022

You need to add each reference assembly with a -reference option. ikvmc itself won't expand wildcards. Also, you'll need to provide -runtime pointing to the IKVM.Runtime assembly.

@Loffe
Copy link

Loffe commented Sep 15, 2022

Ah, I see. I was under the impression that globbing was supported, both by the comment above mentioning -reference:<ikvmtools>/refs/*.dll and also in #45 (comment).

Manually expanding the list of all reference dll:s (and using a response file with all arguments) got it working 😃 👍

@rayanngage2
Copy link

can I ask what did you do to got it working

I can't repaire it
D:\jarpack>ikvmc -out:bcp-sdk-1.0.0.RELEASE.dll bcp-sdk-1.0.0.RELEASE.jar -nostdlib -r:*.dll
ikvmc (8.4.4+Branch.main.Sha.103f78408061ddcb58e3a5715ff02893ca0216b2)
Copyright ? 2023 Jeroen Frijters, Windward Studios, Jerome Haltom, Shad Storhaug

Error: unable to find 'netstandard.dll'.

@GeorgeS2019
Copy link

GeorgeS2019 commented Apr 1, 2023

@NightOwl888

#45 (comment)

I have the same problem today using 8.5.0-develop.690 After this approach fail

<ItemGroup>
  <IkvmReference Include="..\..\ext\helloworld-2.0.jar" />
</ItemGroup>

=> we need to re-open this issue

@google-mirror
Copy link

can I ask what did you do to got it working

I can't repaire it D:\jarpack>ikvmc -out:bcp-sdk-1.0.0.RELEASE.dll bcp-sdk-1.0.0.RELEASE.jar -nostdlib -r:*.dll ikvmc (8.4.4+Branch.main.Sha.103f78408061ddcb58e3a5715ff02893ca0216b2) Copyright ? 2023 Jeroen Frijters, Windward Studios, Jerome Haltom, Shad Storhaug

Error: unable to find 'netstandard.dll'.

the same error

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

7 participants