Graal: Substrate VM build step fails on MacOSX

Created on 5 Jan 2018  路  7Comments  路  Source: oracle/graal

Followed the quick start guide

  • Env
Mac OS : 10.12.6 
 ~/install/graal/graal/substratevm (master) $ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b01-internal-jvmci-0.38, mixed mode)
$ mx build 
....
Archiving CHROMEINSPECTOR_TEST... [dependency com.oracle.truffle.tools.chromeinspector.test updated]
Compiling org.graalvm.compiler.virtual with javac-daemon... [dependency GRAAL_OPTIONS_PROCESSOR updated]
Compiling org.graalvm.compiler.loop.phases with javac-daemon... [dependency GRAAL_OPTIONS_PROCESSOR updated]
Compiling com.oracle.truffle.api.dsl.test with javac-daemon... [dependency TRUFFLE_DSL_PROCESSOR updated]
Compiling org.graalvm.compiler.replacements with javac-daemon... [dependency GRAAL_OPTIONS_PROCESSOR updated]
Compiling com.oracle.truffle.api.interop.java.test with javac-daemon... [dependency TRUFFLE_DSL_PROCESSOR updated]
Archiving TRUFFLE_SL_TEST... [dependency com.oracle.truffle.sl.test updated]
java.util.ServiceConfigurationError: com.oracle.truffle.api.TruffleRuntimeAccess: Provider org.graalvm.compiler.truffle.hotspot.HotSpotTruffleRuntimeAccess not a subtype
    at java.util.ServiceLoader.fail(ServiceLoader.java:239)
    at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at com.oracle.truffle.api.Truffle.selectTruffleRuntimeAccess(Truffle.java:64)
    at com.oracle.truffle.api.Truffle.access$000(Truffle.java:39)
    at com.oracle.truffle.api.Truffle$1.run(Truffle.java:145)
    at com.oracle.truffle.api.Truffle$1.run(Truffle.java:118)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.oracle.truffle.api.Truffle.initRuntime(Truffle.java:118)
    at com.oracle.truffle.api.Truffle.<clinit>(Truffle.java:48)
    at com.oracle.truffle.api.TruffleOptions.<clinit>(TruffleOptions.java:126)
    at com.oracle.truffle.api.interop.Message.valueOf(Message.java:753)
    at com.oracle.truffle.dsl.processor.interop.Utils.getMessage(Utils.java:56)
    at com.oracle.truffle.dsl.processor.interop.MessageGenerator.getGenerator(MessageGenerator.java:151)
    at com.oracle.truffle.dsl.processor.interop.InteropDSLProcessor.processResolveClass(InteropDSLProcessor.java:229)
    at com.oracle.truffle.dsl.processor.interop.InteropDSLProcessor.processElement(InteropDSLProcessor.java:167)
    at com.oracle.truffle.dsl.processor.interop.InteropDSLProcessor.process0(InteropDSLProcessor.java:90)
    at com.oracle.truffle.dsl.processor.interop.InteropDSLProcessor.process(InteropDSLProcessor.java:83)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
    at com.sun.tools.javac.main.Main.compile(Main.java:523)
    at com.sun.tools.javac.main.Main.compile(Main.java:381)
    at com.sun.tools.javac.main.Main.compile(Main.java:370)
    at com.sun.tools.javac.main.Main.compile(Main.java:361)
    at com.sun.tools.javac.Main.compile(Main.java:56)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.oracle.mxtool.compilerserver.JavacDaemon$JavacCompiler.compile(JavacDaemon.java:32)
    at com.oracle.mxtool.compilerserver.CompilerDaemon$Connection.run(CompilerDaemon.java:149)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
/Users/sgopal1/install/graal/graal/truffle/src/com.oracle.truffle.api.interop.java.test/src/com/oracle/truffle/api/interop/java/test/OwnMessageResolutionTest.java:35: error: Uncaught error in class com.oracle.truffle.dsl.processor.interop.InteropDSLProcessor: com.oracle.truffle.api.TruffleRuntimeAccess: Provider org.graalvm.compiler.truffle.hotspot.HotSpotTruffleRuntimeAccess not a subtype
public class OwnMessageResolutionTest {
bug native-image

Most helpful comment

point JAVA_HOME to a labsjdk

Make sure you use labsjdk but NOT the GraalVM as your JAVA_HOME, i.e., at the bottom in the web page http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html

All 7 comments

Seeing the same thing. Mac OS High Sierra 10.13.1.

point JAVA_HOME to a labsjdk

Make sure you use labsjdk but NOT the GraalVM as your JAVA_HOME, i.e., at the bottom in the web page http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html

@mur47x111 thanks. That worked.

On a related note, the basic hello world took 27 sec to create the executable with 6.2M.

 mx image -cp $PWD/svmbuild -H:Class=HelloWorld -H:Name=helloworld
   classlist:   1,393.76 ms
       (cap):   1,199.42 ms
       setup:   2,505.62 ms
  (typeflow):   5,160.20 ms
   (objects):   2,861.16 ms
  (features):     144.85 ms
    analysis:   8,383.10 ms
14 method(s) included for runtime compilation
    universe:     549.18 ms
     (parse):   1,342.98 ms
   (compile):   6,965.44 ms
     compile:   9,047.91 ms
       image:   2,941.40 ms
       write:   2,195.59 ms
     [total]:  27,119.20 ms

Is this the expected time for compilation or is there any way to optimize it?

@sureshg we will clarify this in the documentation.

Long compilation time is expected. SVM provides a server mode that could help with multiple image building in a row: mx image_server_start, and then you could run your image building command with -server parameter, e.g., mx image -server -cp $PWD/svmbuild -H:Class=HelloWorld -H:Name=helloworld. The first image build would be of similar speed, but will get faster in the subsequent builds when the image server code is JITed.

@mur47x111 thanks, image_server reduced the compile time to 9 seconds. By the way, any idea why image_server_start and image command helps are not displayed for mx help ?

@sureshg mx help will show common utilities as well as commands defined in the current mx-managed repo. Try cd to graal/substratevm and type mx help.

I think we should only load JVMCI Truffle providers if Truffle is on the boot class path:

diff --git a/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java b/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java
index ea1aa294bc..c761f61d95 100644
--- a/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java
+++ b/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java
@@ -137,7 +137,8 @@ public class Truffle {
                     ServiceLoader<TruffleRuntimeAccess> standardProviders = ServiceLoader.load(TruffleRuntimeAccess.class);
                     access = selectTruffleRuntimeAccess(standardProviders);
                 } else {
-                    Iterable<TruffleRuntimeAccess> jvmciProviders = getJVMCIProviders();
+                    // Only look for JVMCI providers if Truffle is on the boot class path.
+                    Iterable<TruffleRuntimeAccess> jvmciProviders = Truffle.class.getClassLoader() == null ? getJVMCIProviders() : null;
                     if (Boolean.getBoolean("truffle.TrustAllTruffleRuntimeProviders")) {
                         ServiceLoader<TruffleRuntimeAccess> standardProviders = ServiceLoader.load(TruffleRuntimeAccess.class);
                         access = selectTruffleRuntimeAccess(jvmciProviders, standardProviders);

What do you think @chumer ? This will prevent issues such as the above where Truffle is picked up from the javac annotation processor class path.

Was this page helpful?
0 / 5 - 0 ratings