dashaun / java-native-builder-multiarch

A single `Cloud Native Buildpack` that can build native images for AMD64 and ARM64
Apache License 2.0
4 stars 1 forks source link

Cannot run image on arm64 (raspberry) #1

Closed d-eder closed 1 year ago

d-eder commented 1 year ago

Hello,

I built a native spring boot image using the gradle task BootBuildImage with and builder "dashaun/builder-multiarch:latest". The image is working locally on my pc (AMD).

Then I tried on my raspberry (arm64). Here it is failing with following error: error while loading shared libraries: libfreetype.so: cannot open shared object file: No such file or directory

Gradle config:

tasks.withType(org.springframework.boot.gradle.tasks.bundling.BootBuildImage::class.java) {
    imageName.set(imageName)
    builder.set("dashaun/java-native-builder-arm64:latest")
}

Do you have a solution for that?

d-eder commented 1 year ago

Reopened. I tested this with another application and here the error also exists

dashaun commented 1 year ago

@d-eder Can you please try with the latest version of the builder?

"dashaun/builder:tiny"

d-eder commented 1 year ago

With that image I get the error message:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error

The architecture is amd64 (where i built the image) but I'd like to run it on an arm64 (raspberry). Or do I have to specify something?

Some of my applications are working with the image dashaun/java-native-builder-arm64:latest. But some of them are having the libfreetype.so issue

dashaun commented 1 year ago

This buildpack does not allow you to generate ARM64 native images, from AMD64 machines.

However, it does allow you to generate ARM64 native images, from ARM64 machines, like your Raspberry Pi.

Generating native images from Raspberry Pi takes some time, last time I think it took me 17 minutes. I personally haven't done it in months, but I know it still works, as other members of the community are reporting back to me.

If you have an M1 machine, you can generate ARM64 images there, and run them on Raspberry Pi.

Alternatively, you can create an ARM64 workflow on CircleCI, to generate the ARM64 native image.

There is an example of that in this repository -> https://github.com/dashaun/dev.dashaun.service.gateway