Graalvm native image
1.설치
1) Graalvm 설치
www.graalvm.org/docs/getting-started/#install-graalvm
github.com/graalvm/graalvm-ce-builds/releases
os : windows 10 pro
해당하는 파일 다운로드
setx환경변수 설정이지만
그냥 cmd.exe에서 설정함
set PATH=D:\develop\program\graalvm-ce-java8-21.0.0.2\bin;%PATH%
set JAVA_HOME=D:\develop\program\graalvm-ce-java8-21.0.0.2
set PATH=D:\develop\program\graalvm-ce-java8-21.0.0.2\bin;%PATH%
set JAVA_HOME=D:\develop\program\graalvm-ce-java8-21.0.0.2
setx 환경변수 설정방법
setx /M PATH "D:\develop\program\graalvm-ce-java8-21.0.0.2\bin;%PATH%"
setx /M JAVA_HOME "D:\develop\program\graalvm-ce-java8-21.0.0.2"
2) 추가설치
1)
Download the SDK file GRMSDKX_EN_DVD.iso for from Microsoft.
www.microsoft.com/en-us/download/details.aspx?id=8442
Mount the image by opening F:\Setup\SDKSetup.exe directly.
2)
visaul studio Build Tools 2019 설치
Start -> Visual Studio 2019 ->x64 Native Tools Command Prompt
에서 실행해야함
그렇지 않는 경우 아래 2가지 오류가 발생함
1) Error: Default native-compiler executable 'cl.exe' not found via environment varialbe PATH
2) Error: Native-image building on Windows currently only supports target architecture: AMD64 ((x64) unsupported)
2. Code작성
HelloWorld.java
3. native image 빌드
D:\develop\graalvm_ws>native-image HelloWorld
[helloworld:5400] classlist: 1,195.32 ms, 1.14 GB
[helloworld:5400] setup: 1,413.75 ms, 1.14 GB
Error: Native-image building on Windows currently only supports target architecture: AMD64 ((x64) unsupported)
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
D:\develop\graalvm_ws>native-image -H:-CheckToolchain HelloWorld
[helloworld:40832] classlist: 1,432.10 ms, 1.15 GB
[helloworld:40832] (cap): 4,629.42 ms, 1.15 GB
[helloworld:40832] setup: 6,745.06 ms, 1.15 GB
[helloworld:40832] (clinit): 132.44 ms, 1.61 GB
[helloworld:40832] (typeflow): 3,455.79 ms, 1.61 GB
[helloworld:40832] (objects): 2,803.94 ms, 1.61 GB
[helloworld:40832] (features): 145.35 ms, 1.61 GB
[helloworld:40832] analysis: 6,665.44 ms, 1.61 GB
[helloworld:40832] universe: 324.37 ms, 1.61 GB
[helloworld:40832] (parse): 736.25 ms, 1.64 GB
[helloworld:40832] (inline): 870.19 ms, 1.64 GB
[helloworld:40832] (compile): 4,358.17 ms, 1.78 GB
[helloworld:40832] compile: 6,352.63 ms, 1.78 GB
[helloworld:40832] image: 568.52 ms, 1.78 GB
[helloworld:40832] write: 725.91 ms, 1.78 GB
[helloworld:40832] [total]: 23,002.35 ms, 1.78 GB
성공!!
추가 참고사항