-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Hey there GraalVM devs,
This is a bit lengthier, so I need to explain the context and background a bit.
I have been using Java since a few years, though I am still a ruby dev mostly.
I am using Linux most of the time. On linux I have a class called "Run", in
a file called run.rb. This file I use as a wrapper to compile tons of things.
For instance, I can do:
run Foobar.java
And it will simply do "javac", then run the created .class file.
When I moved to GraalVM and found native-image, I also used the static image
option.
So for instance, doing the above and change it towards:
run Foobar.java --superstatic # my special flag
Will first do javac, and then it will do this:
native-image -H:+StaticExecutableWithDynamicLibC Foobar
It will create a binary, and then my wrapper script also runs upx or whatever
the name was to reduce the size. And the resulting binary works! \o/
On windows I have more problems. I recently installed the cl.exe binary via
visual studio and tested hello_world.cpp, and it works. I could compile it on
windows.
But this is where I have problems. I installed native-image, and then I
try the exact same command as above. On Windows. And this fails.
I can not seem to get native-image to work AT ALL.
So when I do:
native-image Foobar
I get this output:
========================================================================================================================
GraalVM Native Image: Generating 'foobar' (executable)...
========================================================================================================================
[1/7] Initializing... (0.0s @ 0.10GB)
Error: Native-image building on Windows currently only supports target architecture: AMD64 (32-bit architecture x86 unsupported)
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
------------------------------------------------------------------------------------------------------------------------
0.2s (2.5% of total time) in 6 GCs | Peak RSS: 0.41GB | CPU load: 1.56
========================================================================================================================
Failed generating 'foobar' after 5.9s.
Error: Image build request failed with exit status 1
To me this is absolutely useless information.
It also confuses me.
For instance it mentions: "Native-image building on Windows currently only supports target architecture: AMD64 (32-bit architecture x86 unsupported)"
Does this mean the windows version I use is not 64bit binary? Because I am quite sure it is.
Anyway, I would suggest first to help alleviate this to INDICATE which binary version the target computer is
using. Because I am certain I use 64 bit. On windows I seem to have both 64 bit and 32 bit in the C:/programs
hierarchy or something. But I am confused about the above output anyway, so please consider improving on
this to lessen the confusion.
Even aside from this, I am left wondering "what the heck isn't working here?" The error message shown is
close to being useless.
I then ran the suggestion above via that other commandline option but this produces even more useless
information to me such as :
Error: Type CCharPointer has a size of 8 bytes, but accessed C value has a size of 4 bytes; to suppress this error, use the annotation @AllowWideningCast
method org.graalvm.nativeimage.c.type.CCharPointerPointer.read()
Error: Type CCharPointer has a size of 8 bytes, but accessed C value has a size of 4 bytes; to suppress this error, use the annotation @AllowWideningCast
method org.graalvm.nativeimage.c.type.CCharPointerPointer.read(SignedWord)
Anyway. Please consider improvement the information shown when an error like this happens. The code is
exactly the same on linux and windows. It works on linux fine. It does not work on windows at all, and I am
left wondering what the heck is going on.