Skip to content

[Native Image] Native image compiled with -march=native fails to execute on the same machine (Linux Arch) #10037

Closed
@gavr123456789

Description

@gavr123456789

Describe the Issue

Can't run the binary which was compiled with -march=native, if this flags removed, it runs.

CPU: 12th Gen Intel® Core™ i9-12900H × 20

This was not the case with GraalVM 21.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java --version
java 23.0.1 2024-10-15
Java(TM) SE Runtime Environment Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01, mixed mode, sharing)

Operating System and Version

Linux precision5570 6.11.6-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024 03:30:35 +0000 x86_64 GNU/Linux

Build Command

Using id("org.graalvm.buildtools.native") version "0.10.3"

graalvmNative {
    binaries {
        named("main") {
            mainClass.set("main.MainKt")
        }
    }
    binaries.all {

        imageName.set("niva")
        buildArgs.add("-O3")
        this.runtimeArgs()
        buildArgs.add("--no-fallback")
        buildArgs.add("-march=native")
        buildArgs.add("--initialize-at-build-time")
    }
}

Expected Behavior

The resulting binary runs on the same machine on which it was compiled.

Actual Behavior

Getting

The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, AMD_3DNOW_PREFETCH, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, TSC, TSCINV_BIT, AVX, AVX2, AES, ERMS, CLMUL, BMI1, BMI2, ADX, SHA, FMA, VZEROUPPER, FLUSH, FLUSHOPT, CLWB, SERIALIZE, RDTSCP, RDPID, FSRM, GFNI, F16C, PKU, OSPKE, CET_IBT, CET_SS].
Please rebuild the executable with an appropriate setting of the -march option.⏎

Steps to Reproduce

Build any binary with -march=native flag, try to run it.

Additional Context

If I remove -march=native I can run the binary.

Build Log Output and Error Messages

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions