Using GraalVM master, building native-image Hello World with embedded JIT-less languages (-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime -Dgraalvm.ForcePolyglotInvalid=false) would produce runtime error:
Fatal error: Unknown node class: com.oracle.truffle.api.impl.DefaultDirectCallNode
We know that it worked on 5970ec82a2e4f2d9810ff1c88f412b45da551901 but I'm uncertain whether internal API changed, or if this was regression.
Reproducer:
javac Main.java
native-image Main -Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime -Dgraalvm.ForcePolyglotInvalid=false --language:js
./main
Main.java
```java
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
​
public class Main{
public static void main(String[] args) {
Context polyglot = Context.create("js");
Value array = polyglot.eval("js", "['Hello from js!!!']");
String polyglotResponse = array.getArrayElement(0).asString();
System.out.println(polyglotResponse);
}
}
````
Crash log:
runtime_crash_log.txt
@lazar-mitrovic this is the result of merging https://github.com/oracle/graal/pull/2415
Specifically: https://github.com/oracle/graal/commit/691923f6188ce0c5d6a9233024e4208fe7d8fbab
Adding -cp truffle-api.jar to the native-image command should give you a working image build.
@lazar-mitrovic is using -Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime a common usecase. If it is, I have to come up with something better than https://github.com/oracle/graal/commit/691923f6188ce0c5d6a9233024e4208fe7d8fbab
It is, we should check for both of them.
It'll try to change https://github.com/oracle/graal/blob/master/truffle/mx.truffle/macro-truffle.properties
to contain -cp truffle-api.jar. Then we don't need https://github.com/oracle/graal/commit/691923f6188ce0c5d6a9233024e4208fe7d8fbab at all.
Most helpful comment
@lazar-mitrovic this is the result of merging https://github.com/oracle/graal/pull/2415
Specifically: https://github.com/oracle/graal/commit/691923f6188ce0c5d6a9233024e4208fe7d8fbab
Adding
-cp truffle-api.jarto the native-image command should give you a working image build.