Skip to content

[Native Image] Failed to automatically set up Windows build environment despite Visual Studio Build Tools installed #12403

@mint-lover-12

Description

@mint-lover-12

Describe the Issue

Information:
Graal version:
GraalVM CE 21.0.8+12.1

OS:
Windows 11 x64

Command ran:
native-image.cmd --shared -H:Name=x-cp x.jar x (also tried with direct native-image path)

Compiler:
Visual Studio 2022 Build Tools, Desktop C++ workload, MSVC v143, Windows SDK 10/11

CMD:
x64 Native Tools Command Prompt for VS 2022 and normal CMD

Error:
Error: Failed to automatically set up Windows build environment.
Please make sure that Visual Studio 2022 version 17.1.0 or later is installed on your system. You can download it at https://visualstudio.microsoft.com/downloads/. If this error persists, please try and run GraalVM Native Image in an x64 Native Tools Command Prompt or file a ticket.

I have also reinstalled VSC2022 with the Desktop C++ workload, it did not work.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "21.0.8" 2025-07-15 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.8+12.1 (build 21.0.8+12-LTS-jvmci-23.1-b72)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.8+12.1 (build 21.0.8+12-LTS-jvmci-23.1-b72, mixed mode, sharing)

Operating System and Version

Windows 11 x64

Build Command

native-image.cmd --shared -H:Name=x-cp x.jar x (also tried with direct native-image path)

Expected Behavior

Convert said .class -> native DLL

Actual Behavior

Fails with:
Error: Failed to automatically set up Windows build environment.
Please make sure that Visual Studio 2022 version 17.1.0 or later is installed on your system. You can download it at https://visualstudio.microsoft.com/downloads/. If this error persists, please try and run GraalVM Native Image in an x64 Native Tools Command Prompt or file a ticket.

Steps to Reproduce

I'm unsure, as no one else seems to have this issue. I just set up Graal and this happened.

Additional Context

No response

Build Log Output and Error Messages

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions