libgdx / packr

Packages your JAR, assets and a JVM for distribution on Windows, Linux and Mac OS X
Apache License 2.0
2.57k stars 171 forks source link

Packr cannot recognise `jrePath` Temurin JRE and JDK zips for Windows #220

Open touhidurrr opened 2 years ago

touhidurrr commented 2 years ago

I tried with JRE and JDK Temurin 11 builds for Windows x64 and x86_64 from here: https://adoptium.net/temurin/releases/

Packr cannot recogise either JDK or JRE and throws the following error:

> java.io.IOException: Couldn't find JRE in JDK, see '/home/runner/work/buildUnciv/buildUnciv/desktop/packr/tmp'

Example Tests: https://github.com/touhidurrr/buildUnciv/runs/6430297670?check_suite_focus=true#step:6:170

karlsabo commented 2 years ago

I can't tell what you're running. You can check that directory to make sure it has a 'jvm.dll' file in there with the proper directory structure.

touhidurrr commented 2 years ago

I can't tell what you're running. You can check that directory to make sure it has a 'jvm.dll' file in there with the proper directory structure.

In short it was working fine with some Java 8 oldjdks. However when I tried to use latest Temurin 11 JDK or JRE zips for windows x64 or x86_64, it failed. The only thing the changed for packr was the link in this line: https://github.com/touhidurrr/buildUnciv/blob/9bf7ec0416c399aa9056bc70798b5a52b269cd66/.github/workflows/buildAndRelease.yml#L49 i don't think packr would throw java.io.IOException: Couldn't find JRE in JDK for anything esle.

karlsabo commented 2 years ago

I haven’t tried the latest adoptium jdks. You could try forking and updating the test to see what happens.

https://github.com/libgdx/packr/blob/e6a277d86f1e7e28ad356dac65f0f90e206bd4ba/TestAppJreDist/testAppJreDist.gradle.kts#L144

touhidurrr commented 2 years ago

@karlsabo from my tests:

admin@touhidurrr:~ $ find /usr/lib/jvm/temurin-11-jdk-armhf | grep -P 'jvm.dll|libjvm.so|libjvm.dylib'
/usr/lib/jvm/temurin-11-jdk-armhf/lib/client/libjvm.so
/usr/lib/jvm/temurin-11-jdk-armhf/lib/server/libjvm.so
admin@touhidurrr:~ $ find /usr/lib/jvm/java-11-openjdk-armhf | grep -P 'jvm.dll|libjvm.so|libjvm.dylib'
/usr/lib/jvm/java-11-openjdk-armhf/lib/server/libjvm.so

As you can see the lib or bin directory holding these files is clearly separted in client and server folders. However, don't think Packr currently checks for it. https://github.com/libgdx/packr/blob/e6a277d86f1e7e28ad356dac65f0f90e206bd4ba/Packr/src/main/java/com/badlogicgames/packr/Packr.java#L488-L498 I think fixing this would fix the issue.

touhidurrr commented 2 years ago

Ignore https://github.com/libgdx/packr/issues/220#issuecomment-1127826862, I forgot this was a Windows specific issue. Also my analysis isn't correct.

touhidurrr commented 2 years ago

For Temurin:

~$ find . | grep -P 'jvm.dll|libjvm.so|libjvm.dylib'
./bin/client/jvm.dll
./bin/server/jvm.dll

for OldJDK

$ find . | grep -P 'jvm.dll|libjvm.so|libjvm.dylib'
./jre/bin/server/jvm.dll

does it doesn't work because for Temurin it is the folder root?

touhidurrr commented 2 years ago

ok @karlsabo I have built the packr from libgdx/packr:master@e6a277d which is the current latest on: https://github.com/touhidurrr/packr/releases/tag/1653143085084336432

And tested it with Temurin Releases.

The result? Failure. CI Tests

karlsabo commented 2 years ago

I updated the test suite to use the latest Temurin JDKs and JREs and they work without issue.

Take a look at the list of JDKs and JREs that are used in testing: https://github.com/libgdx/packr/blob/6d1d5b6eefd3f6b0381ec980c1eb77440b425170/TestAppJreDist/testAppJreDist.gradle.kts