Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-52996] NPE when using the minimal vs_BuildTools.exe with vswhere.exe in 24.1.0 #8669

Open
sheng-ri opened this issue Mar 29, 2024 · 3 comments

Comments

@sheng-ri
Copy link

Feature request

Is your feature request related to a problem? Please describe.
For my personal reasons, I need to install msvc and windows sdk in other path, so when using cmd to run native-image, I need run vcvars64 before using native-image.
Now i'm try Gradle plugin for GraalVM Native Image building, The previous method is useless.

Describe the solution you'd like.
Specify a enviroment path to found vcvarsall or add a arg to specify it.

Describe who do you think will benefit the most.
GraalVM users, developers of libraries and frameworks and those tho first try native-image.

Describe alternatives you've considered.
for learning purposes,I found these way to solve problem.....

mkdir "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build>"
echo "F:\Visual Studio\VC\Auxiliary\Build\vcvars64.bat" %* > "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat"

Express whether you'd like to help contributing this feature
I apologize, but I don't have the ability to contribute at the moment due to my limitations.

@fniephaus
Copy link
Member

Thanks for the feature request! We've got some good news for you: As of #8084, Native Image uses vswhere.exe to locate Visual Studio installations. This make the detection more reliable and it should also support custom installation locations. This feature will be available in the next EA 05 build of GraalVM and will ship with GraalVM for JDK 23.

Please feel free to give this a try and let us know if something is not working for you. Hope this helps!

@fniephaus fniephaus self-assigned this Mar 31, 2024
@sheng-ri
Copy link
Author

Thanks for your reply,After my testing there are still problems.

My env
I only download the vs build tool.
https://aka.ms/vs/17/release/vs_BuildTools.exe
Then select msvc and windows 10 sdk.
In this way, you can download msvc without visual studio editor.

Test result
vswhere.exe -version 17.6 -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format json
[]

native-image -jar .\untitled-1.0-SNAPSHOT.jar test

       at java.base@23/java.util.Objects.requireNonNull(Objects.java:220)
       at java.base@23/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:215)
       at java.base@23/java.nio.file.Path.of(Path.java:148)
       at java.base@23/java.nio.file.Paths.get(Paths.java:69)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.WindowsBuildEnvironmentUtil.findVCVarsallWithVSWhere(WindowsBuildEnvironmentUtil.java:114)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.WindowsBuildEnvironmentUtil.propagateEnv(WindowsBuildEnvironmentUtil.java:53)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.buildImage(NativeImage.java:1689)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.completeImageBuild(NativeImage.java:1329)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1880)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1845)
       at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1827)
       at java.base@23/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

@fniephaus
Copy link
Member

I'm not sure if vs_BuildTools.exe fulfills the requirements but we should handle the NPE. Thanks for bringing this up!

@fniephaus fniephaus reopened this Mar 31, 2024
@oubidar-Abderrahim oubidar-Abderrahim changed the title Add a option to provide varsallall path [GR-52996] Add a option to provide varsallall path Apr 1, 2024
@oubidar-Abderrahim oubidar-Abderrahim removed their assignment Apr 1, 2024
@oubidar-Abderrahim oubidar-Abderrahim changed the title [GR-52996] Add a option to provide varsallall path [GR-52996] NPE when using the minimal vs_BuildTools.exe with vswhere.exe in 24.1.0 Apr 1, 2024
brett-smith added a commit to sshtools/jadbus that referenced this issue Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants