-2


I wanted to check out the mx image generator:

./mx image -cp $PWD/svmbuild -H:Class=HelloWorld -H:Name=helloworld
mx: unknown command 'image'

It seems that the "image" command is not available (anymore?)
Any replacement available? Thanks

Francesco Marchioni
  • 4,091
  • 1
  • 25
  • 40

1 Answers1

1

There's an mx native-image command.

The README file in the GraalVM project repository lists the following quick start snippet:

cd substratevm
mx build

echo "public class HelloWorld { public static void main(String[] args) { 
System.out.println(\"Hello World\"); } }" > HelloWorld.java
$JAVA_HOME/bin/javac HelloWorld.java
mx native-image HelloWorld
./helloworld

Allegedly, one needs a JDK 8 with the JVMCI for this to work, here's a relevant quote from the README:

Install mx and point JAVA_HOME to a labsjdk.

For compilation native-image depends on the local toolchain, so make sure: glibc-devel, zlib-devel (header files for the C library and zlib) and gcc are available on your system.

Oleg Šelajev
  • 3,530
  • 1
  • 17
  • 25
  • Thanks for your reply. I have installed GraalVM CE and put it into the PATH and JAVA_HOME: `java -version openjdk version "1.8.0_192" OpenJDK Runtime Environment (build .8.0_192-20181024121959.buildslave.jdk8u-src-tar--b12) GraalVM 1.0.0-rc10 (build 25.192-b12-jvmci-0.53, mixed mode)` `~/mx-master:$ echo $JAVA_HOME /home/francesco/graalvm-ce-1.0.0-rc10` Is this what you mean to point to a labsjdk? – Francesco Marchioni Dec 20 '18 at 10:29
  • A "labsjdk" is a regular JDK 8 with the addition of JVMCI (CI = Compiler interface) that allows the replacement of the top tier compiler and plug the Graal compiler instead of the Hotspot one. You can download it here : https://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html Java versions >8 are bundled with JVMCI, so no need of a modified JDK if you use JDK11 for instance. – ffarquet Jan 17 '19 at 10:36