graalvm / mandrel

Mandrel is a downstream distribution of the GraalVM community edition. Mandrel's main goal is to provide a native-image release specifically to support Quarkus.
Other
395 stars 15 forks source link

Libgraal failing to compile with Java 11 #149

Closed galderz closed 4 years ago

galderz commented 4 years ago

Re: #146

I've double checked @Karm's comment and I'm having issues also with 0d53b7344d498167cf0b25f9a5e9b36bbb7b7775 when calling mx build from substratevm:

Archiving SVM_HOSTED... [dependency com.oracle.svm.core.jdk11 updated]
/Users/g/1/mandrel-mandrel/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFeature.java:604: error: cannot find symbol
        long javaThreadAddr = HotSpotJVMCIRuntime.runtime().getCurrentJavaThread();
                                                           ^
  symbol:   method getCurrentJavaThread()
  location: class HotSpotJVMCIRuntime
1 error

Compiling com.oracle.svm.graal.hotspot.libgraal with javac-daemon(JDK 11) failed
1 build tasks failed

The missing method is in jdk/jdk (see https://github.com/openjdk/jdk/commit/e15849a0f8e44600d38d56f1c1b2518c66ac67a3), but the backport of that bug to Java didn't include that commit (see my comment in JDK-8242648).

zakkak commented 4 years ago

The LibGraal component is not part of Mandrel, thus this issue does not appear when building with https://github.com/graalvm/mandrel-packaging.

It appears that by default mx build includes LibGraal and that's what is causing this issue:

$ mx --primary-suite substratevm graalvm-show    
GraalVM distribution: GRAALVM_72562F6962_JAVA11
Version: 20.3.0-dev
Config name: None
Components:
 - LibGraal ('lg', /False)
 - Truffle ('tfl', /truffle)
 - SubstrateVM ('svm', /svm)
 - Native Image licence files ('nil', /svm)
 - Native Image ('ni', /svm)
 - SubstrateVM LLVM ('svml', /svm)
 - Polyglot Native API ('polynative', /polyglot)
 - Disassembler ('dis', /graal)
 - LLVM.org toolchain ('llp', /llvm)
 - Truffle NFI ('nfi', /nfi)
 - Truffle Macro ('tflm', /truffle)
 - Polyglot Launcher ('poly', /polyglot)
 - Native Image JUnit ('nju', /junit)
 - Native Image Configure Tool ('nic', /svm)
 - GraalVM compiler ('cmp', /graal)
 - Graal SDK ('sdk', /graalvm)
 - Polyglot Library ('libpoly', /polyglot)
Launchers:
 - native-image (bash)
 - polyglot (bash)
 - native-image-configure (bash)
Libraries:
 - libjvmcicompiler.so (skipped)
 - libnative-image-agent.so (skipped)
 - libnative-image-diagnostics-agent.so (skipped)
 - libpolyglot.so (skipped)
No installable
No standalone

Building using mx --primary-suite-path substratevm --components='Native Image' build should work around this issue if you don't want to use mandrel-packaging.

$ mx --primary-suite-path substratevm --components='Native Image' graalvm-show 
GraalVM distribution: GRAALVM_0C036694EE_JAVA11
Version: 20.3.0-dev
Config name: None
Components:
 - Native Image ('ni', /svm)
 - SubstrateVM ('svm', /svm)
 - Native Image licence files ('nil', /svm)
 - GraalVM compiler ('cmp', /graal)
 - Truffle Macro ('tflm', /truffle)
 - Truffle NFI ('nfi', /nfi)
 - Truffle ('tfl', /truffle)
 - Graal SDK ('sdk', /graalvm)
Launchers:
 - native-image (bash)
Libraries:
 - libnative-image-agent.so (skipped)
 - libnative-image-diagnostics-agent.so (skipped)
No installable
No standalone
galderz commented 4 years ago

mx --primary-suite-path substratevm --components='Native Image' build is not enough.

zakkak commented 4 years ago

Indeed, even though it doesn't list LibGraal as a component, GRAAL_HOTSPOT_LIBRARY which depends on com.oracle.svm.graal.hotspot.libgraal somehow makes it into the build plan.

zakkak commented 4 years ago

I marked this as a wontfix since this does not affect building Mandrel with mandrel-packaging.

I am curious though to figure out why GRAAL_HOTSPOT_LIBRARY gets build :)