I use spring boot 3.0.0-RC2, with Java 17 and the newest Docker version 4.14.0. Tested it on an M1 Max. I init a complete plain/new spring project with the Jetbrains IntelliJ project init tool. Then I try to run gradle bootBuildImage but it gets stuck at this point:

    [creator]     ================================================================================
    [creator]     GraalVM Native Image: Generating '/layers/paketo-buildpacks_native-image/native-image/com.example.demo1rtert.Demo1rtertApplicationKt' (static executable)...
    [creator]     ================================================================================
    [creator]     [1/7] Initializing...                                           (39.4s @ 0.19GB)
    [creator]      Version info: 'GraalVM 22.3.0 Java 17 CE'
    [creator]      Java version info: '17.0.5+8-LTS'
    [creator]      C compiler: gcc (linux, x86_64, 7.5.0)
    [creator]      Garbage collector: Serial GC
    [creator]      1 user-specific feature(s)
    [creator]      - org.springframework.aot.nativex.feature.PreComputeFieldFeature
    [creator]     Field org.springframework.core.NativeDetector#imageCode set to true at build time
    [creator]     Field org.springframework.core.KotlinDetector#kotlinPresent set to true at build time
    [creator]     Field org.springframework.core.KotlinDetector#kotlinReflectPresent set to true at build time
    [creator]     Field org.springframework.format.support.DefaultFormattingConversionService#jsr354Present set to false at build time

It is there for hours.

build.gradle.kts:

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id("org.springframework.boot") version "3.0.0-RC2"
    id("io.spring.dependency-management") version "1.1.0"
    id("org.graalvm.buildtools.native") version "0.9.17"
    kotlin("jvm") version "1.7.20"
    kotlin("plugin.spring") version "1.7.20"
}

group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_17

repositories {
    mavenCentral()
    maven { url = uri("https://repo.spring.io/milestone") }
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("io.projectreactor:reactor-test")
}

tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xjsr305=strict")
        jvmTarget = "17"
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

Bildschirm­foto 2022-11-13 um 18 16 54

Comment From: snicoll

@JakobStadlhuber thanks for the report but I am not sure what you expect us to do with a screenshot and a build script. Can you please try outside of IntelliJ IDEA for a start? If you can reproduce, getting the threads dump of the process could help us figure out where that's coming from.

Comment From: wilkinsona

My guess would be that Docker doesn't have enough memory and the native compilation is suffering from GC thrash. How much memory have you allocated to Docker, @JakobStadlhuber?

Comment From: dr-eme

The issue is with the paketo builder, which uses an AMD64 image which runs with QEMU on ARM systems like Apple Silicon, and performance is very poor.

While there is no official support for ARM64 just yet, there is a preliminary workaround by using the following experimental builder:

bootBuildImage {
  if (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentArchitecture().isArm()) {
    builder = 'dashaun/java-native-builder-arm64'
  }
}

Please note that the compiled image will be ARM64. More info about the experimental builder can be found here: https://github.com/dashaun/paketo-arm64

Comment From: JakobStadlhuber

Thank you @dr-eme thats it. I am just wondering why this is not mentioned anywhere, especially because how many devs using systems from Apple where ARM is de facto the standard for 2 years.

Comment From: wilkinsona

Given that this is a limitation that Spring Boot cannot control, we should probably mention it on the wiki.

Comment From: wilkinsona

The wiki has been updated.

Comment From: JakobStadlhuber

The issue is with the paketo builder, which uses an AMD64 image which runs with QEMU on ARM systems like Apple Silicon, and performance is very poor.

While there is no official support for ARM64 just yet, there is a preliminary workaround by using the following experimental builder:

bootBuildImage { if (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentArchitecture().isArm()) { builder = 'dashaun/java-native-builder-arm64' } }

Please note that the compiled image will be ARM64. More info about the experimental builder can be found here: https://github.com/dashaun/paketo-arm64

For Gradle Kotlin:

tasks.withType<BootBuildImage> {
    if (org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentArchitecture().isArm) {
        builder.set("dashaun/builder-arm:tiny")
    }
}