roc-java icon indicating copy to clipboard operation
roc-java copied to clipboard

Can't build using OpenJDK 17

Open gavv opened this issue 2 years ago • 4 comments

Currently, I'm able to build roc-java using OpenJDK 8, but not OpenJDK 17.

OpenJDK 8 is not available in next debian stable candidate, so it would be nice to fix build with recent version. Otherwise you need to install older JDK manually.


When using OpenJDK 17, I get the following error:

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':roc_jni'.
> Could not open proj remapped class cache for 6ln1p28aqpsv1qjk04pyeijya (/home/victor/.gradle/caches/6.4/scripts-remapped/build_bvwlj1vorvl1q0nbtcfbai48m/6ln1p28aqpsv1qjk04pyeijya/proj68a30bfc7da5ef859cd7b983445462e5).
   > Could not open proj generic class cache for build file '/home/victor/dev/roc-streaming/roc-java/roc_jni/build.gradle' (/home/victor/.gradle/caches/6.4/scripts/6ln1p28aqpsv1qjk04pyeijya/proj/proj68a30bfc7da5ef859cd7b983445462e5).
      > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --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 2s

If I download JDK 8 from here and added it to PATH:

PATH="/some/path/jdk8u362-b09/bin:$PATH" ./gradlew build

everything works.

gavv avatar Apr 03 '23 09:04 gavv

we have gradle 6.4 https://github.com/roc-streaming/roc-java/blob/main/gradle/wrapper/gradle-wrapper.properties#L3 and it doesn't support java 17

https://stackoverflow.com/questions/68597899/bug-exception-in-phase-semantic-analysis-in-source-unit-buildscript-unsup

Compatibility table: https://docs.gradle.org/current/userguide/compatibility.html

ortex avatar Apr 12 '23 16:04 ortex

If we update gradle, will it still work on java 8? If yes, I'd suggest to update.

gavv avatar Apr 13 '23 12:04 gavv

If we update gradle, will it still work on java 8?

I think so. Now it works with java 11.

The main problem is that maven plugin was removed from 7+ version. https://docs.gradle.org/current/userguide/upgrading_version_6.html#removal_of_the_legacy_maven_plugin

We using it for upload aar to maven central https://github.com/roc-streaming/roc-java/blob/main/android/roc-android/build.gradle#L2

But I guess it shouldn't be too hard to migrate to new maven-publish plugin :)

ortex avatar Apr 13 '23 17:04 ortex

After fixing this, we'll need to add java17 step to CI jobs for linux and osx. Also we can switch release step to java17 too.

gavv avatar May 14 '23 06:05 gavv