Search code examples
graalvmgraalvm-native-imagecl.exe

cl.exe missing when building native app using GraalVM


I'm trying to build a native application using GraalVM and native-image. An error occures when starting the build process. It seems the cl.exe is missing in the classpath. Like mentioned on the GraalVM website, i've installed the "GRMSDKX_EN_DVD.iso" (Windows SDK for Windows 7 and .NET). I've also tried installing the Windows SDK for Windows 10.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>native-image -jar C:\Users\tm\Desktop\DemoGraalVM\target\Demo-1.0-SNAPSHOT.jar
[Demo-1.0-SNAPSHOT:28776]    classlist:   2,435.83 ms,  1.16 GB
[Demo-1.0-SNAPSHOT:28776]        setup:     646.59 ms,  1.16 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
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1

I'm using windows 10, graalvm-ce-java8-windows-amd64-20.2.0. I'm also running Visual Studio Community Edition and use the Visual Studio 2019 Developer Command Prompt v16.3.1. The Java application is build in IntelliJ Community Edition using Maven.

How can I fix this? Where do I download the cl.exe or which installation package contains this file?


Solution

  • After 2 years struggling I gave up on trying to use GraalVM to build native executables. I now use the jPackage command line tool. It comes by default with the latest versions of Java. Works like a charm. No hassle, no additional dependencies, no errors, free, ...

    More info: https://youtu.be/ZGW9AalZLN4