Closed Tonne-TM closed 2 years ago
@dmikusa-pivotal Could you please share an update about the latest status of Apple M1 support for building native images?
At present:
You can attempt to build your app as an x86_64 container. This will be really slow. To confirm that you'll get an x86_64 container, run docker run ubuntu:latest uname -a
and ensure the output indicates x86_64, not ARM64. If it says x86_64 then your build should work OK.
You can use https://github.com/dmikusa-pivotal/paketo-arm64 to build your own images. This will produce native images which will be very fast.
You can use https://hub.docker.com/r/dashaun/java-native-builder-arm64 as your builder. This is an image published using the tools from # 2 and published by @dashaun. It'll be very fast as well.
All of these options should work though.
The project will at some point publish official builders but there's still a lot of work that needs to happen before we can do that. The options above are a stopgap until we can get all that work done.
I've not seen this error before:
[creator] Error: Collecting native-compiler info with '/usr/bin/gcc -v' failed
[creator] Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
[creator] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[creator] --------------------------------------------------------------------------------
[creator] 0.9s (3.5% of total time) in 9 GCs | Peak RSS: 0.84GB | CPU load: 3.27
[creator] ================================================================================
[creator] Failed generating '/layers/paketo-buildpacks_native-image/native-image/com.example.springbootnative.SpringBootNativeApplication' after 21.5s.
[creator] Error: Image build request failed with exit status 1
My initial thought would be to try docker.io/paketobuildpacks/builder:base
instead of docker.io/paketobuildpacks/builder:tiny
and see if that helps. It's unlikely but I suppose it's possible something changed with tiny or a requirement was added that we don't include in tiny. If using base
builder works, I can look into that more.
Also, try...
@dmikusa-pivotal Thanks a lot for the detailed feedback.
@Tonne-TM Are you trying to build a x86_64 image or a ARM64 one?
@sdeleuze Actually I am actually not sure. I just wanted to try out spring native on my Mac by using gradle :bootBuildImage
.
Based on the documentation, I would suspect a Linux_64 docker image with native executable.
Is this supposed to work on Mac, if not, maybe some kind of check should be added to the Gradle task.
@Tonne-TM See https://github.com/spring-projects-experimental/spring-native/issues/1642#issuecomment-1156442819 where Daniel explained how to check if you are using x86_64 image or a ARM64 image.
docker run ubuntu:latest uname -a 125 ↵
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
ed02c6ade914: Pull complete
Digest: sha256:b6b83d3c331794420340093eb706a6f152d9c1fa51b262d9bf34594887c2c7ac
Status: Downloaded newer image for ubuntu:latest
Linux 21f9a0b1d260 5.10.76-linuxkit #1 SMP PREEMPT Mon Nov 8 11:22:26 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
Seems like it is running ARM64
So not supported in Buildpacks yet, see @dmikusa-pivotal comment if you want to play with the early support, otherwise subscribe to https://github.com/paketo-buildpacks/stacks/issues/51 and please wait the official support.
Example if you are comfortable using the community-provided builder with ARM64:
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>dashaun/java-native-builder-arm64</builder>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sorry for the noise at this closed ticket, but I just wanted to confirm that the builder of @dashaun is working for me even with Spring Boot 3 and Java 17.
Thanks for that note @klopfdreh
For anyone else finding their way here: Everything you love about Spring Native is now baked into Spring Boot 3 which is GA. The latest version of my "community-provided builder with ARM64" can be found in my fork of dmikusa/paketo-arm64 and it delivers Spring Boot 3 native images for ARM64 & AMD64
I am always getting the same error when trying to build native image via build packs. (Building directly on the machine works fine)
My Setup:
Full logs of
gradle :bootBuildImage
: