报错内容:
The curpent machine does not support all of the following cPU features that arerequired by the image: [CX8, CMOU, FXSR, MMK, SSE, SSE2, SSE3, SSSE3, SSE4 1. SSE4 2,POPCNT,LZCNT,AUX, AUX2,BMI1,BMI2,FMA. F16CJ.Please rebuild the executable with an appropriate setting of the -marchoption.

报错原因:
native-image 默认参数 march的值为x86-64-v3。旧的cpu不支持。因此需要修改该参数为compatibility。
修改pom中插件:

<plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
                <configuration>
                    <buildArgs>
                        <buildArg>-march=compatibility</buildArg>
                    </buildArgs>
                </configuration>
            </plugin>

graalvm 打包命令:
mvn -Pnative native:compile
graalvm 环境搭建参考其他文章。
native-image march列表
image.png


晓辉
2 声望0 粉丝