borkdude / clj-reflector-graal-java11-fix

A fix for an issue with clojure.lang.Reflector in GraalVM native-image JDK11.
Eclipse Public License 1.0
15 stars 1 forks source link

Version for latest GraalVM CE LTS release, 19.3.2? #1

Closed aviflax closed 4 years ago

aviflax commented 4 years ago

Hi, thanks for making this!

The README says:

Use the right GraalVM version modifier: graalvm-19.3.1 or graalvm-20.0.0. The modifier must exactly match the version of GraalVM native-image.

I just downloaded GraalVM CE for my Mac and it looks like the latest CE LTS release is 19.3.2.

Do you have any plans to release a version of this library that works with 19.3.2?

Is this something I could help with?

Thanks!

borkdude commented 4 years ago

Just pushed https://clojars.org/borkdude/clj-reflector-graal-java11-fix/versions/0.0.1-graalvm-19.3.2.

Can you try it?

aviflax commented 4 years ago

🤯 wow 🏎

Will do!

aviflax commented 4 years ago

I’m having some trouble.

My deps.edn With a few irrelevant aliases elided: ```clojure {:deps {org.clojure/clojure {:mvn/version "1.10.2-alpha1"} cli-matic {:git/url "https://github.com/l3nz/cli-matic" :sha "2640ad5b6dcc2ae0638f79d0edb9f007351487b0" :tag "v0.3.11"} clj-commons/clj-yaml {:mvn/version "0.7.0"} medley {:git/url "https://github.com/weavejester/medley" :sha "6c79c4cce52b276daa3c2b6eaea78f96904bca56" :tag "1.3.0"} selmer {:mvn/version "1.12.23"}} :aliases {:compile-for-native-image {:extra-deps {borkdude/clj-reflector-graal-java11-fix {:mvn/version "0.0.1-graalvm-19.3.2"}}}}} ```

My project compiles fine:

$ clojure -A:compile-for-native-image -e "(compile 'dad.cli)"
dad.cli
$ echo $?
0

But when I attempt to compile to native image, it fails:

~/dev/dad $ native-image \
>   -cp "$(clojure -A:compile-for-native-image -Spath):classes" \
>   -H:Name=dad \
>   -H:+ReportExceptionStackTraces \
>   --initialize-at-build-time  \
>   --verbose \
>   --no-fallback \
>   --no-server \
>   "-J-Xms5g" \
>   "-J-Xmx5g" \
>   dad.cli
Error: Invalid or corrupt jarfile /Users/avi.flax/.m2/repository/org/graalvm/nativeimage/svm-hosted-native-linux-amd64/19.3.2/svm-hosted-native-linux-amd64-19.3.2.tar.gz
Caused by: java.util.zip.ZipException: zip END header not found
com.oracle.svm.driver.NativeImage$NativeImageError: Invalid or corrupt jarfile /Users/avi.flax/.m2/repository/org/graalvm/nativeimage/svm-hosted-native-linux-amd64/19.3.2/svm-hosted-native-linux-amd64-19.3.2.tar.gz
    at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1486)
    at com.oracle.svm.driver.NativeImage.processJarManifestMainAttributes(NativeImage.java:948)
    at com.oracle.svm.driver.NativeImage.processManifestMainAttributes(NativeImage.java:935)
    at com.oracle.svm.driver.NativeImage.addImageClasspathEntry(NativeImage.java:1407)
    at com.oracle.svm.driver.NativeImage.addCustomImageClasspath(NativeImage.java:1377)
    at com.oracle.svm.driver.DefaultOptionHandler.processClasspathArgs(DefaultOptionHandler.java:230)
    at com.oracle.svm.driver.DefaultOptionHandler.consume(DefaultOptionHandler.java:103)
    at com.oracle.svm.driver.NativeImage$NativeImageArgsProcessor.apply(NativeImage.java:1326)
    at com.oracle.svm.driver.NativeImage.processNativeImageArgs(NativeImage.java:1526)
    at com.oracle.svm.driver.NativeImage.completeImageBuild(NativeImage.java:988)
    at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1252)
    at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1222)
    at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1181)
    at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1665)
Caused by: java.util.zip.ZipException: zip END header not found
    at java.util.zip.ZipFile$Source.zerror(ZipFile.java:1535)
    at java.util.zip.ZipFile$Source.findEND(ZipFile.java:1436)
    at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1443)
    at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1274)
    at java.util.zip.ZipFile$Source.get(ZipFile.java:1237)
    at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:727)
    at java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:52)
    at java.util.zip.ZipFile.<init>(ZipFile.java:247)
    at java.util.zip.ZipFile.<init>(ZipFile.java:177)
    at java.util.jar.JarFile.<init>(JarFile.java:348)
    at java.util.jar.JarFile.<init>(JarFile.java:319)
    at java.util.jar.JarFile.<init>(JarFile.java:285)
    at com.oracle.svm.driver.NativeImage.processJarManifestMainAttributes(NativeImage.java:940)
    ... 12 more

I’m using MacOS 10.15.4… any suggestions?

borkdude commented 4 years ago

@aviflax This issue should now be solved using the latest recommendations by @lread added to the README.