1

I am trying to build a Spring Boot application by using Eclipse + Maven + GraalVM on Windows and I am getting the following stackTrace:

[es.datik.graal_spring_proba.main.main:11756]        setup:   1,832.97 ms,  1.51 GB
Error: Default native-compiler executable 'cl.exe' not found via environment variable PATH
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
com.oracle.svm.core.util.UserError$UserException: Default native-compiler executable 'cl.exe' not found via environment variable PATH
To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
    at com.oracle.svm.core.util.UserError.abort(UserError.java:139)
    at com.oracle.svm.hosted.c.codegen.CCompilerInvoker.addSkipCheckingInfo(CCompilerInvoker.java:105)
    at com.oracle.svm.hosted.c.codegen.CCompilerInvoker.<init>(CCompilerInvoker.java:73)
    at com.oracle.svm.hosted.c.codegen.CCompilerInvoker$WindowsCCompilerInvoker.<init>(CCompilerInvoker.java:111)
    at com.oracle.svm.hosted.c.codegen.CCompilerInvoker.create(CCompilerInvoker.java:85)
    at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:869)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:556)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:471)
    at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)

I followed the steps included in the spring site documentation. However I was not able to reproduce it and build my app. The sequence was:

  1. Download "GraalVM-CE-java8-20.3.0" and unzip in my local computer.
  2. Add GraalVM to Eclipse: Window -> Preferences -> Java -> Installed JREs -> Add -> Select unzipped GraalVM folder
  3. My POM.xlm is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>es.datik</groupId>
  <artifactId>graal_spring_proba</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  
  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
  
  <properties>
        <java.version>1.8</java.version>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.experimental</groupId>
            <artifactId>spring-graalvm-native</artifactId>
            <version>0.8.3</version>
        </dependency>
    </dependencies>
    
    <profiles>
      <profile>
        <id>native</id>
        <build>
          <plugins>
            <plugin>
              <groupId>org.graalvm.nativeimage</groupId>
              <artifactId>native-image-maven-plugin</artifactId>
              <version>20.3.0</version>
              <configuration>
                <mainClass>es.datik.graal_spring_proba.main.Main</mainClass>
                <buildArgs>
                    -Dspring.native.remove-yaml-support=true
                    -Dspring.spel.ignore=true
                </buildArgs>
              </configuration>
              <executions>
                <execution>
                  <goals>
                    <goal>native-image</goal>
                  </goals>
                  <phase>package</phase>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
          </plugins>
        </build>
      </profile>
    </profiles>
  
</project>
  1. Configure "Run Configurations" to build the project:
  1. Main class does nothing special. Just follows the official GraalVM "CountUppercase" example.

  2. GraalVM official doc informs about prerequisites on Windows: MSVC 2010 SP1 for JDK 8. In addition, I found this thread on StackOverflow with the same response.

  3. I checked my installed packages and I found that I already had that installed. However I attempted to download it from the Microsoft site. When executing "vcredist_x64.exe", the system detected the package as installed, because it offered me to repair the installation if needed.

Has someone succesfully build a Spring Boot application with Eclipse + Maven + GraalVM on Windows?

You can find my setup below:

  • Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz 3.31GHz
  • 12 GB RAM
  • Windows 10 Pro (x64)
  • Eclipse Neon.3 Release (4.6.3)
  • Maven runtime Eclipse-embedded (3.3.9)
  • GraalVM-CE-java8-20.3.0

Could you please give me some tips about where am I failing?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • This sound like a windows problem for superuser.SE – Thorbjørn Ravn Andersen Feb 10 '21 at 16:25
  • The location of cl.exe (the Visual C++ compiler) is not on the path by default (it only is added when you use a Visual Studio/Native Tools command prompt). As documented in the [GraalVM documentation](https://www.graalvm.org/docs/getting-started/windows/): _"On Windows the native-image tool only works when it is executed from the x64 Native Tools Command Prompt."_. I'm not sure how you can configure it appropriately to run from Eclipse. – Mark Rotteveel Feb 10 '21 at 16:31
  • Yes Mark, indeed I read that "Visual Studio/Native Tools command prompt" quote... but I hoped someone in the world had the same requirements as mines and find a solution for it. Maybe there's no other choice than looking for another workaround without Eclipse or just wait for GraalVM & Spring community – DragonWarrior Feb 11 '21 at 08:25

0 Answers0