Closed nadeemahmad770 closed 1 month ago
Off the top of my head, it sounds like we may be missing something in the GraalVM install that you have installed locally. How did you install GraalVM locally?
The buildpacks you have running are fetching GraalVM (Bellsoft NIK) from here. Can you give that a try and see if you have similar issues locally?
You can also try different vendors with buildpacks and see if that helps. See https://paketo.io/docs/howto/java/#use-an-alternative-java-native-image-toolkit It would be helpful to know if you have the same issue for all vendors.
Thanks
Thank you @dmikusa for your response.
Issue got resolved by changing the buildpacks version in the image configuration under maven plugin. Fixed with following config:
<image>
<name>${module.image.name}</name>
<env>
<BP_JVM_VERSION>21.0.2</BP_JVM_VERSION>
<BP_GRAALVM_VERSION>21.0.2</BP_GRAALVM_VERSION>
</env>
<buildpacks>
<buildpack>gcr.io/paketo-buildpacks/graalvm</buildpack>
<buildpack>gcr.io/paketo-buildpacks/java-native-image</buildpack>
</buildpacks>
</image>
Excellent! Thanks for sharing the fix.
Used the following command to execute the compilation and everything works: mvn -Pnative -DskipTests package -X
However, executing with the following command fails: mvn -Pnative clean spring-boot:build-image
Describing GraalVM and environment: GraalVM version: Oracle graalvm-jdk-21.0.4+8.1 JDK major version: 21.0.3 (2024-04-16 LTS) OS: Linux Architecture: AMD64
Expected Behavior
Expecting a success native-build with GraalJS features (Polyglot)
Current Behavior
We are using graalJS with polyglot module and Paketo Buildpack fails the build as it is unable to use macro:truffle-svm arg
Possible Solution
Steps to Reproduce
build the app with mvn -Pnative clean spring-boot:build-image
Logs:
Security report:
The log4j library has been detected, but the version is unavailable. Due to Log4Shell, please ensure log4j is at version 2.17.1 or later.
Finished generating 'app' in 5m 38s. [INFO] [INFO] --- spring-boot:3.2.3:repackage (repackage) @ app--- [INFO] <<< spring-boot:3.2.3:build-image (default-cli) < package @ app<<< [INFO] [INFO] [INFO] --- spring-boot:3.2.3:build-image (default-cli) @ app--- [INFO] Building image 'docker.io/library/app:1.0.0' [INFO] [INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-tiny:latest' 100% [INFO] > Pulled builder image 'paketobuildpacks/builder-jammy-tiny@sha256:cc16db4d7a2062e4d86e725921e4c52423af5d14056ff81dd5defadb047826f7' [INFO] > Pulling run image 'docker.io/paketobuildpacks/run-jammy-tiny:latest' 100% [INFO] > Pulled run image 'paketobuildpacks/run-jammy-tiny@sha256:402b925a81a4c6985438fd37d0b22022ca688e528bbd46a38831a3702067cced' [INFO] > Executing lifecycle version v0.20.2 [INFO] > Using build cache volume 'pack-cache-46374cfa2663.build' [INFO] [INFO] > Running creator [INFO] [creator] ===> ANALYZING [INFO] [creator] ===> DETECTING [INFO] [creator] target distro name/version labels not found, reading /etc/os-release file [INFO] [creator] 6 of 15 buildpacks participating [INFO] [creator] paketo-buildpacks/ca-certificates 3.8.6 [INFO] [creator] paketo-buildpacks/bellsoft-liberica 10.8.4 [INFO] [creator] paketo-buildpacks/syft 2.1.0 [INFO] [creator] paketo-buildpacks/executable-jar 6.11.2 [INFO] [creator] paketo-buildpacks/spring-boot 5.31.2 [INFO] [creator] paketo-buildpacks/native-image 5.14.3 [INFO] [creator] ===> RESTORING [INFO] [creator] ===> BUILDING [INFO] [creator] target distro name/version labels not found, reading /etc/os-release file [INFO] [creator] [INFO] [creator] Paketo Buildpack for CA Certificates 3.8.6 [INFO] [creator] https://github.com/paketo-buildpacks/ca-certificates [INFO] [creator] Build Configuration: [INFO] [creator] $BP_EMBED_CERTS false Embed certificates into the image [INFO] [creator] $BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime [INFO] [creator] $BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime [INFO] [creator] Launch Helper: Contributing to layer [INFO] [creator] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper [INFO] [creator] [INFO] [creator] Paketo Buildpack for BellSoft Liberica 10.8.4 [INFO] [creator] https://github.com/paketo-buildpacks/bellsoft-liberica [INFO] [creator] Build Configuration: [INFO] [creator] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted) [INFO] [creator] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE [INFO] [creator] $BP_JVM_TYPE JRE the JVM type - JDK or JRE [INFO] [creator] $BP_JVM_VERSION 17 the Java version [INFO] [creator] Launch Configuration: [INFO] [creator] $BPL_DEBUG_ENABLED false enables Java remote debugging support [INFO] [creator] $BPL_DEBUG_PORT 8000 configure the remote debugging port [INFO] [creator] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached [INFO] [creator] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path [INFO] [creator] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT) [INFO] [creator] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail [INFO] [creator] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments [INFO] [creator] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR) [INFO] [creator] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX) [INFO] [creator] $BPL_JMX_PORT 5000 configure the JMX port [INFO] [creator] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation [INFO] [creator] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation [INFO] [creator] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation [INFO] [creator] $JAVA_TOOL_OPTIONS the JVM launch flags [INFO] [creator] Using Java version 21 extracted from MANIFEST.MF [INFO] [creator] BellSoft Liberica NIK 21.0.4: Contributing to layer [INFO] [creator] Downloading from https://github.com/bell-sw/LibericaNIK/releases/download/23.1.4+3-21.0.4+9/bellsoft-liberica-vm-core-openjdk21.0.4+9-23.1.4+3-linux-amd64.tar.gz [INFO] [creator] Verifying checksum [INFO] [creator] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/native-image-svm [INFO] [creator] Adding 146 container CA certificates to JVM truststore [INFO] [creator] Writing env.build/JAVA_HOME.override [INFO] [creator] Writing env.build/JDK_HOME.override [INFO] [creator] [INFO] [creator] Paketo Buildpack for Syft 2.1.0 [INFO] [creator] https://github.com/paketo-buildpacks/syft [INFO] [creator] Downloading from https://github.com/anchore/syft/releases/download/v1.12.2/syft_1.12.2_linux_amd64.tar.gz [INFO] [creator] Verifying checksum [INFO] [creator] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default [INFO] [creator] [INFO] [creator] Paketo Buildpack for Executable JAR 6.11.2 [INFO] [creator] https://github.com/paketo-buildpacks/executable-jar [INFO] [creator] Class Path: Contributing to layer [INFO] [creator] Writing env/CLASSPATH.delim [INFO] [creator] Writing env/CLASSPATH.prepend [INFO] [creator] Process types: [INFO] [creator] executable-jar: java org.springframework.boot.loader.launch.JarLauncher (direct) [INFO] [creator] task: java org.springframework.boot.loader.launch.JarLauncher (direct) [INFO] [creator] web: java org.springframework.boot.loader.launch.JarLauncher (direct) [INFO] [creator] [INFO] [creator] Paketo Buildpack for Spring Boot 5.31.2 [INFO] [creator] https://github.com/paketo-buildpacks/spring-boot [INFO] [creator] Build Configuration: [INFO] [creator] $BPL_JVM_CDS_ENABLED false whether to enable CDS optimizations at runtime [INFO] [creator] $BPL_SPRING_AOT_ENABLED false whether to enable Spring AOT at runtime [INFO] [creator] $BP_JVM_CDS_ENABLED false whether to enable CDS & perform JVM training run [INFO] [creator] $BP_SPRING_AOT_ENABLED true whether to enable Spring AOT [INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support [INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_VERSION 1 default version of Spring Cloud Bindings library to contribute [INFO] [creator] Launch Configuration: [INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings [INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings [INFO] [creator] Class Path: Contributing to layer [INFO] [creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE.default [INFO] [creator] Writing env.build/CLASSPATH.append [INFO] [creator] Writing env.build/CLASSPATH.delim [INFO] [creator] Image labels: [INFO] [creator] org.opencontainers.image.title [INFO] [creator] org.opencontainers.image.version [INFO] [creator] org.springframework.boot.version [INFO] [creator] [INFO] [creator] Paketo Buildpack for Native Image 5.14.3 [INFO] [creator] https://github.com/paketo-buildpacks/native-image [INFO] [creator] Build Configuration: [INFO] [creator] $BP_BINARY_COMPRESSION_METHOD Compression mechanism used to reduce binary size. Options:
none
(default),upx
orgzexe
[INFO] [creator] $BP_NATIVE_IMAGE true enable native image build [INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS --initialize-at-build-time=ch.qos.logback,org.slf4j,org.springframework.context.support.ReloadableResourceBundleMessageSource,com.a.b.c.Config --trace-class-initialization=ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.StatusBase,org.slf4j.LoggerFactory,ch.qos.logback.classic.Level,ch.qos.logback.classic.Logger,ch.qos.logback.core.status.InfoStatus,org.springframework.context.support.ReloadableResourceBundleMessageSource -H:+ReportExceptionStackTraces arguments to pass to the native-image command [INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE /workspace/META-INF/native-image/argfile a file with arguments to pass to the native-image command [INFO] [creator] $BP_NATIVE_IMAGE_BUILT_ARTIFACT the built application artifact explicitly, required if building from a JAR ^[[58;28R[INFO] [creator] Native Image: Contributing to layer [INFO] [creator] Executing native-image --no-fallback -H:+StaticExecutableWithDynamicLibC @/workspace/META-INF/native-image/argfile --initialize-at-build-time=ch.qos.logback,org.slf4j,org.springframework.context.support.ReloadableResourceBundleMessageSource,com.a.b.c.Config --trace-class-initialization=ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.StatusBase,org.slf4j.LoggerFactory,ch.qos.logback.classic.Level,ch.qos.logback.classic.Logger,ch.qos.logback.core.status.InfoStatus,org.springframework.context.support.ReloadableResourceBundleMessageSource -H:+ReportExceptionStackTraces -H:Name=/layers/paketo-buildpacks_native-image/native-image/com.a.b.c.application -cp /workspace:/workspace/BOOT-INF/classes:/workspace/BOOT-INF/lib/logback-classic-1.4.14.jar:/workspace/BOOT-INF/lib/logback-core-1.4.14.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.21.1.jar:/workspace/BOOT-INF/lib/log4j-api-2.21.1.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-2.0.12.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-2.1.1.jar:/workspace/BOOT-INF/lib/snakeyaml-2.2.jar:/workspace/BOOT-INF/lib/spring-boot-actuator-autoconfigure-3.2.3.jar:/workspace/BOOT-INF/lib/spring-boot-actuator-3.2.3.jar:/workspace/BOOT-INF/lib/jackson-databind-2.15.4.jar:/workspace/BOOT-INF/lib/jackson-annotations-2.15.4.jar:/workspace/BOOT-INF/lib/jackson-core-2.15.4.jar:/workspace/BOOT-INF/lib/jackson-datatype-jsr310-2.15.4.jar:/workspace/BOOT-INF/lib/micrometer-observation-1.12.3.jar:/workspace/BOOT-INF/lib/micrometer-commons-1.12.3.jar:/workspace/BOOT-INF/lib/micrometer-jakarta9-1.12.3.jar:/workspace/BOOT-INF/lib/micrometer-core-1.12.3.jar:/workspace/BOOT-INF/lib/HdrHistogram-2.1.12.jar:/workspace/BOOT-INF/lib/LatencyUtils-2.0.3.jar:/workspace/BOOT-INF/lib/spring-aop-6.1.4.jar:/workspace/BOOT-INF/lib/spring-beans-6.1.4.jar:/workspace/BOOT-INF/lib/spring-security-config-6.2.2.jar:/workspace/BOOT-INF/lib/spring-context-6.1.4.jar:/workspace/BOOT-INF/lib/spring-security-web-6.2.2.jar:/workspace/BOOT-INF/lib/spring-expression-6.1.4.jar:/workspace/BOOT-INF/lib/springdoc-openapi-starter-webflux-ui-2.3.0.jar:/workspace/BOOT-INF/lib/springdoc-openapi-starter-webflux-api-2.3.0.jar:/workspace/BOOT-INF/lib/springdoc-openapi-starter-common-2.3.0.jar:/workspace/BOOT-INF/lib/swagger-core-jakarta-2.2.19.jar:/workspace/BOOT-INF/lib/commons-lang3-3.13.0.jar:/workspace/BOOT-INF/lib/swagger-annotations-jakarta-2.2.19.jar:/workspace/BOOT-INF/lib/swagger-models-jakarta-2.2.19.jar:/workspace/BOOT-INF/lib/jackson-dataformat-yaml-2.15.4.jar:/workspace/BOOT-INF/lib/swagger-ui-5.10.3.jar:/workspace/BOOT-INF/lib/spring-boot-3.2.3.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-3.2.3.jar:/workspace/BOOT-INF/lib/jakarta.xml.bind-api-4.0.1.jar:/workspace/BOOT-INF/lib/jakarta.activation-api-2.1.2.jar:/workspace/BOOT-INF/lib/byte-buddy-1.14.12.jar:/workspace/BOOT-INF/lib/spring-core-6.1.4.jar:/workspace/BOOT-INF/lib/spring-jcl-6.1.4.jar:/workspace/BOOT-INF/lib/reactor-core-3.6.3.jar:/workspace/BOOT-INF/lib/tomcat-embed-el-10.1.19.jar:/workspace/BOOT-INF/lib/hibernate-validator-8.0.1.Final.jar:/workspace/BOOT-INF/lib/jakarta.validation-api-3.0.2.jar:/workspace/BOOT-INF/lib/jboss-logging-3.5.3.Final.jar:/workspace/BOOT-INF/lib/classmate-1.6.0.jar:/workspace/BOOT-INF/lib/jackson-datatype-jdk8-2.15.4.jar:/workspace/BOOT-INF/lib/jackson-module-parameter-names-2.15.4.jar:/workspace/BOOT-INF/lib/reactor-netty-http-1.1.16.jar:/workspace/BOOT-INF/lib/netty-codec-http-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-common-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-buffer-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-transport-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-codec-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-handler-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-codec-http2-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-codec-dns-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-native-macos-4.1.107.Final-osx-x86_64.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-classes-macos-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-transport-native-epoll-4.1.107.Final-linux-x86_64.jar:/workspace/BOOT-INF/lib/netty-transport-native-unix-common-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-transport-classes-epoll-4.1.107.Final.jar:/workspace/BOOT-INF/lib/reactor-netty-core-1.1.16.jar:/workspace/BOOT-INF/lib/netty-handler-proxy-4.1.107.Final.jar:/workspace/BOOT-INF/lib/netty-codec-socks-4.1.107.Final.jar:/workspace/BOOT-INF/lib/spring-web-6.1.4.jar:/workspace/BOOT-INF/lib/spring-webflux-6.1.4.jar:/workspace/BOOT-INF/lib/aspectjweaver-1.9.21.jar:/workspace/BOOT-INF/lib/HikariCP-5.0.1.jar:/workspace/BOOT-INF/lib/spring-jdbc-6.1.4.jar:/workspace/BOOT-INF/lib/hibernate-core-6.4.2.Final.jar:/workspace/BOOT-INF/lib/jakarta.persistence-api-3.1.0.jar:/workspace/BOOT-INF/lib/jakarta.transaction-api-2.0.1.jar:/workspace/BOOT-INF/lib/hibernate-commons-annotations-6.0.6.Final.jar:/workspace/BOOT-INF/lib/jandex-3.1.2.jar:/workspace/BOOT-INF/lib/jaxb-runtime-4.0.4.jar:/workspace/BOOT-INF/lib/jaxb-core-4.0.4.jar:/workspace/BOOT-INF/lib/angus-activation-2.0.1.jar:/workspace/BOOT-INF/lib/txw2-4.0.4.jar:/workspace/BOOT-INF/lib/istack-commons-runtime-4.1.2.jar:/workspace/BOOT-INF/lib/jakarta.inject-api-2.0.1.jar:/workspace/BOOT-INF/lib/antlr4-runtime-4.13.0.jar:/workspace/BOOT-INF/lib/spring-data-jpa-3.2.3.jar:/workspace/BOOT-INF/lib/spring-data-commons-3.2.3.jar:/workspace/BOOT-INF/lib/spring-orm-6.1.4.jar:/workspace/BOOT-INF/lib/spring-tx-6.1.4.jar:/workspace/BOOT-INF/lib/spring-aspects-6.1.4.jar:/workspace/BOOT-INF/lib/postgresql-42.7.2.jar:/workspace/BOOT-INF/lib/checker-qual-3.42.0.jar:/workspace/BOOT-INF/lib/spring-context-support-6.1.4.jar:/workspace/BOOT-INF/lib/caffeine-3.1.8.jar:/workspace/BOOT-INF/lib/error_prone_annotations-2.21.1.jar:/workspace/BOOT-INF/lib/gson-2.8.9.jar:/workspace/BOOT-INF/lib/json-20210307.jar:/workspace/BOOT-INF/lib/jetty-reactive-httpclient-4.0.3.jar:/workspace/BOOT-INF/lib/reactive-streams-1.0.4.jar:/workspace/BOOT-INF/lib/jetty-client-12.0.6.jar:/workspace/BOOT-INF/lib/jetty-alpn-client-12.0.6.jar:/workspace/BOOT-INF/lib/jetty-http-12.0.6.jar:/workspace/BOOT-INF/lib/jetty-util-12.0.6.jar:/workspace/BOOT-INF/lib/jetty-io-12.0.6.jar:/workspace/BOOT-INF/lib/slf4j-api-2.0.12.jar:/workspace/BOOT-INF/lib/spring-security-core-6.2.2.jar:/workspace/BOOT-INF/lib/spring-security-crypto-6.2.2.jar:/workspace/BOOT-INF/lib/polyglot-23.1.4.jar:/workspace/BOOT-INF/lib/collections-23.1.4.jar:/workspace/BOOT-INF/lib/nativeimage-23.1.4.jar:/workspace/BOOT-INF/lib/word-23.1.4.jar:/workspace/BOOT-INF/lib/js-language-23.1.4.jar:/workspace/BOOT-INF/lib/regex-23.1.4.jar:/workspace/BOOT-INF/lib/truffle-api-23.1.4.jar:/workspace/BOOT-INF/lib/icu4j-23.1.4.jar:/workspace/BOOT-INF/lib/truffle-runtime-23.1.4.jar:/workspace/BOOT-INF/lib/truffle-enterprise-23.1.4.jar:/workspace/BOOT-INF/lib/truffle-compiler-23.1.4.jar:/workspace/BOOT-INF/lib/jniutils-23.1.4.jar:/workspace/BOOT-INF/lib/nativebridge-23.1.4.jar:/workspace/BOOT-INF/lib/spring-boot-jarmode-layertools-3.2.3.jar com.a.b.c.application [INFO] [creator] Error: Processing jar:file:///workspace/BOOT-INF/lib/truffle-api-23.1.4.jar!/META-INF/native-image/org.graalvm.truffle/native-image.properties failed [INFO] [creator] Caused by: com.oracle.svm.driver.NativeImage$NativeImageError: Unknown name in option specification: macro:truffle-svm [INFO] [creator] Available macro options are: [INFO] [creator] --macro:junit [INFO] [creator] --macro:native-image-agent-library [INFO] [creator] --macro:native-image-configure-launcher [INFO] [creator] --macro:native-image-diagnostics-agent-library [INFO] [creator] --macro:native-image-launcher [INFO] [creator] unable to invoke layer creator [INFO] [creator] unable to contribute native-image layer [INFO] [creator] error running build [INFO] [creator] exit status 20 [INFO] [creator] ERROR: failed to build: exit status 1Please suggest if there is any other latest version available which can help in solving this issue.