Closed SuperIceCN closed 3 years ago
Yeah it's great to have windows support indeed. The reason it doesn't have windows support now is that I don't have any windows environment. If someone can add and test windows support I'm happy to merge it :) It should be easy enough to extend the CI to include prebuilt binary by adding extra os here. Additionally some build configuration needs to be modified to stop assuming filesystems path uses slash as a delimiter.
Thanks! Maybe I can give it a try.
@kawamuray I successfuly build a universal jar with windows support. It works well and passes all tests. But I don't know how to use gradle so I built it manually (I have never used gradle before). It seems that build.gradle cannot run on my windows10 computer even if I changed all "/" to "\". The jar I built manually is here: https://github.com/Superice666/wasmtime-java/releases/tag/v0.1.0-windows
I successfuly build a universal jar with windows support.
cool :)
don't know how to use gradle so I built it manually (I have never used gradle before). It seems that build.gradle cannot run on my windows10 computer even if I changed all
can you share the diff and detail of the error you've faced while running gradlew.bat universalJar
(I've never ran gradle on windows but assume this is the right command line to kick the build)?
It prints that:
Configure project : Evaluating root project 'wasmtime-java' using build file 'D:\nukkit\wasmtime-java\build.gradle'.
FAILURE: Build failed with an exception.
Where: Build file 'D:\nukkit\wasmtime-java\build.gradle' line: 101
What went wrong: A problem occurred evaluating root project 'wasmtime-java'.
Could not find method environment() for arguments [CLASSPATH, D:\nukkit\wasmtime-java\build\classes\java\main;D:\nukkit\wasmtime-java\build\resources \main;C:\Users\Superice666.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.25\da76ca59f6a57ee3102f8f9bd9cee742973efa8a\slf4j-api-1.7.25.jar] on t ask ':generateJniInterfaces' of type org.gradle.api.DefaultTask.
Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 974ms
I have push the build.gradle file to my fork. Is there any mistake?
@kawamuray It seems that we cannot use java4h on Windows platform. Windows cannot identify java4h as a executable programme.
Could not find method environment() for arguments
This happens because you've commented out type: Exec
. In gradle (groovy), a closure has implicit default receiver for methods called inside of it, hence the statement environment x, y
is actually an invocation of defaultReceiver(of type Exec).environment()
.
https://github.com/Superice666/wasmtime-java/commit/d49fa463aff33b8847bb17e865a394da40c85ab9#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7R89
Windows cannot identify java4h as a executable programme.
Ugh, right. javah4x
's binary is actually an shell script that contains it's JAR binary inside of it. So it can't be executed on environment that doesn't support running /bin/bash
.
Possible solutions would be:
btw regarding this advice:
Additionally some build configuration needs to be modified to stop assuming filesystems path uses slash as a delimiter.
I turned out that java takes care of implicitly converting path into platform specific type for unix-style path that uses slash as the delimiter, so it seems not necessary fixing around all paths that is in unix style now to build on windows. ref: https://stackoverflow.com/questions/3548775/platform-independent-paths-in-java ref: https://www.sghill.net/how-do-i-make-cross-platform-file-paths-in-java.html
@kawamuray Thanks for your advice! I just managed to fix it build.gradle and push it to my fork. In addition, I added windows to github action CI by the way. You can see it here: https://github.com/Superice666/wasmtime-java/runs/1541057245?check_suite_focus=true I think it's ok to merge it now.
nice :) let me review your patch on #2 then.
Closed by #2
I notice that wasmtime-java has not supported windows yet. I think run on Windows device will be great. By the way, Wasmtime has support windows yet.