-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Get Mill's Graal native image support working on Windows (500USD Bounty) #4274
Comments
@lihaoyi is it fine if I work on this? |
@ayewo go for it, I just put a bounty on it as well |
I've been able to narrow down the issue to the Windows path limit of a maximum of 260 characters. Graal attempts to use the Visual Studio C compiler to compile the following code: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64\cl.exe' \
/WX /W4 /wd4201 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 \
'/FeC:\Users\RUNNER~1\AppData\Local\Temp\SVM-5703768390083211131\RISCV64LibCHelperDirectives.exe' \
'C:\Users\RUNNER~1\AppData\Local\Temp\SVM-5703768390083211131\RISCV64LibCHelperDirectives.c' But the compilation depends on this include which has a path length of 273 chars which is > 260: C:\Users\runneradmin\AppData\Local\Coursier\cache\arc\https\github.com\graalvm\graalvm-ce-builds\releases\download\jdk-17.0.7\graalvm-community-jdk-17.0.7_windows-x64_bin.zip\graalvm-community-openjdk-17.0.7+7.1\lib\svm\clibraries\windows-amd64\include\riscv64cpufeatures.h
I ran some tests and it turns out that On the Windows runner, Coursier' Cache is at: When I grepped the env vars on the Windows runner, I saw that you already use super short paths for build outputs: env | grep D:
GITHUB_WORKSPACE=D:\a\mill\mill
...
RUNNER_WORKSPACE=D:\a\mill So I tried to use a shorter path for the COURSIER_CACHE: 'D:\a\Coursier-Cache' I tried to inject the |
Thanks @ayewo! IIRC I also tried setting the |
@ayewo Managed to make the test PR make more progress, using |
@lihaoyi yes, I'm working on the class loading issue. The native image had |
Scala Native creates a |
One issue is that we don't call clang ourselves AFAIK, but rather call it transitively through Graal's |
That's |
@lihaoyi FYI, in my mill-native-image plugin, on Windows, we put the class path as a manifest JAR (or "pathing JAR") to native-image. I can't recall why, but that could help with the error you're getting (which looks like an issue with the class path passed to native-image) |
I managed to get this test to pass on the Windows runner:
by copying |
So it looks like |
I managed to make it pass in CI by adding the --no-fallback flag to nativeImageOptions, znot sure what the flsg does, but the test completed successfully |
Interesting. According to the Graal docs:
|
I merged the linked PR. Next steps for this ticket are to get publishing working and update the mill.bat script. @ayewo i can probably fix the publishing job but may need your help with mill.bat |
--no-fallback disables the feature to fallback to build a normal Java application if building a native-image doesn't work. Usually you always want to add it since you want a failure, not a Java application on the JVM. |
From the maintainer Li Haoyi: I'm putting a 500USD bounty on this issue, payable by bank transfer on a merged PR implementing this.
Graal native images already work on Mac and Linux, for Windows we basically need to make #4272 pass.
The current problem is we get these errors:
This is very weird, because although it says
Cannot open include file: 'C:\Users\runneradmin\AppData\Local\Coursier\Cache\arc\https\github.com\graalvm\graalvm-ce-builds\releases\download\jdk-17.0.7\graalvm-community-jdk-17.0.7_windows-x64_bin.zip\graalvm-community-openjdk-17.0.7+7.1\lib\svm\clibraries\windows-amd64\include\amd64cpufeatures.h
, when I try to addls ...
ortype ...
of that file to the github actions job the file does exist and I can read itOnce we get the basic Graal unit tests passing on Windows, it should be easy to add a windows publishing job (below) using
windows-latest
to publish windows-compatible Mill executables:mill/.github/workflows/publish-artifacts.yml
Line 103 in bbcc16a
Lastly, we would need to update the windows
mill.bat
launcher with changes similar to #4273 to make it able to download the correct native imagesThe text was updated successfully, but these errors were encountered: