0

I want to. test the Panama project added APIs and the jextract generator for such on a macbook air M2. There don't seem to be any arm64 prebuilt binaries for jextract.

I have zulu jdk 20 installed, cmake, python3, xCode, xCode command line tools, and the latest gradle ( should be enough to run a gradlew which caches the version it wants )

I cloned jextract from

https://github.com/openjdk/jextract.git

JAVA_HOME is set to /Library/Java/JavaVirtualMachines/zulu-20.jdk/Contents/Home

followed the instructions in the README.md It specifies I should do:

sh ./gradlew -Pjdk20_home=<jdk20_home_dir> -Pllvm_home=<libclang_dir> clean verify

Which led to issuing this command to build it.

./gradlew -Pjdk20_home=/Library/Java/JavaVirtualMachines/zulu-20.jdk/Contents/Home -Pllvm_home=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/ clean verify

Building results in this error from javac from gradle:

> Task :compileJava FAILED
error: release version 20 not supported
Usage: javac <options> <source files>
use --help for a list of possible options

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed with exit code 2; see the compiler error output for details.

I have also tried the other llvm paths they suggest. And have also tried older zulu-17 JDK and each time deleted gradle caches, the build folder and re-extracted the source (git reset --hard) from git.

I have searched for a solution for this. I also have searched for a forum on Panama and.or jextract to help me find a solution or any information on building for an apple M1/M2 and have not found anything.

Thanks !

peterk
  • 5,136
  • 6
  • 33
  • 47
  • "error: release version 20 not supported". If this were my problem, I'd definitely concentrate on that first. – Kayaman Aug 17 '23 at 06:28
  • Try using the earlier versions of jextract, if it suffices, which are compatible with earlier versions of java. It seems like gradle (or your version of it) does not support java 20 yet. – ashish.g Aug 17 '23 at 07:13

1 Answers1

1

To run the jextract build, you must have both Java 17 and the target Java version (Java 20 in your case). The actual build is done with Java 17.

Set JAVA_HOME to point to Java 17:

export JAVA_HOME=`/usr/libexec/java_home -v 17`
java -version

Then run the build command:

sh ./gradlew -Pjdk20_home=/Users/user/Documents/zulu20.32.11_1-ca-jdk20.0.2-macosx_aarch64 -Pllvm_home=/Library/Developer/CommandLineTools/usr/ clean verify
Codo
  • 75,595
  • 17
  • 168
  • 206
  • Well works with jdk 17 present and the JAVA_HOME setting to jdk 17. and lieaving the gradle argument at jdk 20 It would be nice to have that info in the readme :) Thanks ! – peterk Aug 17 '23 at 14:39