graalvm / mandrel-packaging

6 stars 8 forks source link

Only build and include svm-foreign when building with JDK > 21 #398

Closed zakkak closed 7 months ago

zakkak commented 7 months ago

Since https://github.com/oracle/graal/pull/7980 the foreign API is only available for JDK >= 22 builds.

Fixes error message:

dependency named SVM_FOREIGN was removed:
  distribution SVM_FOREIGN was removed as all its dependencies were removed:
    project com.oracle.svm.hosted.foreign was removed as JDK 22 is not available

When trying to build with JDK 21.

If accepted I will backport it to 24.0 as well.

jerboaa commented 7 months ago

Also note that IMO it's an (upstream) bug to add attempt to add svm-foreign.jar if --enable-preview is specified. I'm pretty sure a Graal master build with labsjdk 21 and --enable-preview will fail since in that case the native image generator unconditionally attempts to add the dir containing svm-foreign.jar (not present) to the class/module path.

zakkak commented 7 months ago

Also note that IMO it's an (upstream) bug to add attempt to add svm-foreign.jar if --enable-preview is specified. I'm pretty sure a Graal master build with labsjdk 21 and --enable-preview will fail since in that case the native image generator unconditionally attempts to add the dir containing svm-foreign.jar (not present) to the class/module path.

I think that's fixed in https://github.com/oracle/graal/pull/7980

jerboaa commented 7 months ago

CI fails due to too new JDK 23:

Error: Static modifier mismatch: private void com.oracle.svm.core.thread.Target_java_lang_VirtualThread.notifyJvmtiHideFrames(boolean), private static native void java.lang.VirtualThread.notifyJvmtiHideFrames(boolean)

Fixed once this PR merges: https://github.com/oracle/graal/pull/8262

jerboaa commented 7 months ago

Also note that IMO it's an (upstream) bug to add attempt to add svm-foreign.jar if --enable-preview is specified. I'm pretty sure a Graal master build with labsjdk 21 and --enable-preview will fail since in that case the native image generator unconditionally attempts to add the dir containing svm-foreign.jar (not present) to the class/module path.

I think that's fixed in oracle/graal#7980

You are right. Thinking some more about this, we don't need the SVM_FOREIGN dependency on JDK 23 either. Not sure why the build doesn't outright fail...

zakkak commented 7 months ago

we don't need the SVM_FOREIGN dependency on JDK 23 either. Not sure why the build doesn't outright fail...

Why is that? All the checks in GraalVM are for >= 22.

jerboaa commented 7 months ago

we don't need the SVM_FOREIGN dependency on JDK 23 either. Not sure why the build doesn't outright fail...

Why is that? All the checks in GraalVM are for >= 22.

Sorry, I was wrong. However, there is a different problem with getting svm-foreign.jar properly installed for JDK 23. I'll take a look.

jerboaa commented 7 months ago

we don't need the SVM_FOREIGN dependency on JDK 23 either. Not sure why the build doesn't outright fail...

Why is that? All the checks in GraalVM are for >= 22.

Sorry, I was wrong. However, there is a different problem with getting svm-foreign.jar properly installed for JDK 23. I'll take a look.

See #399, which should fix the svm-foreign.jar installation.

zakkak commented 7 months ago

It makes little sense to me to try to keep JDK 21 compatibility in master. The entire JEP 454 story in GraalVM seems not 100% ready yet. See https://github.com/graalvm/mandrel/issues/678

The primary reason for opening this was to prevent build failures when trying to build with JDK 21 so that we can see the actual blocker/issue which is https://github.com/graalvm/mandrel/issues/598

Closing this for now as there are no plans to build master with JDK 21, see https://github.com/graalvm/mandrel/issues/598#issuecomment-1912118196