spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

The mirror failed to boot: How to set the -march option in the image build process.

Open GeTOUO opened this issue 1 year ago • 2 comments

my project config:

springboot 3.1.1 jdk17

I made the image mvn spring-boot:build-image -Pnative with the following command, and then it ran fine locally and failed to boot on a machine in a corporate environment and threw the following exception:

The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA]. Please rebuild the executable with an appropriate setting of the -march option.

How to set the -march option?

GeTOUO avatar Jul 26 '23 03:07 GeTOUO

Where did you build it and where are you trying to run it? What are the architectures of those machines?

You can set the BP_NATIVE_IMAGE_BUILD_ARGUMENTS env variable for pack build with the -e flag. See the Spring Boot build tools docs for how to do that in the pom.xml file.

dmikusa avatar Jul 26 '23 13:07 dmikusa

thanks . pom.xml:

<BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
    -march=compatibility
</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>

GeTOUO avatar Jul 27 '23 15:07 GeTOUO