Reputation: 15870
I'm trying to create a simple native image of hello world, using graalVM v20.0.0 CE.
Initially I was getting a "native toolchain" error, but having launched a command line from "x86 Native Tools Command Prompt for VS2017", I'm over that hurdle.
The problem now is a string of linker errors:
java.lib(jni_util.obj) : error LNK2019: unresolved external symbol __imp_fprintf referenced in function JNU_PrintString
java.lib(jni_util.obj) : error LNK2019: unresolved external symbol __imp___iob_func referenced in function JNU_PrintString
net.lib(net_util_md.obj) : error LNK2019: unresolved external symbol __imp_sprintf referenced in function NET_ThrowNew
net.lib(net_util_md.obj) : error LNK2019: unresolved external symbol __imp_printf referenced in function dumpAddr
jvm.lib(JvmFuncs.obj) : error LNK2019: unresolved external symbol __imp_vfprintf referenced in function jio_vfprintf
jvm.lib(JvmFuncs.obj) : error LNK2019: unresolved external symbol __imp_vsnprintf referenced in function jio_vsnprintf
MSVCRT.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp_vsnprintf
MSVCRT.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp__vsnprintf
D:\Tools\graalvm-ce-java8-20.0.0\bin\helloworld.exe : fatal error LNK1120: 7 unresolved externals
These all seem directly related to that most basic of function calls, printf
.
I reviewed native-image
's command line options, and hoped explicitly setting --shared
or --static
would do the trick, but no dice. None of the other native-image command line options looked relevant.
I further tried starting from the VS2015 version of the same command prompt. Nope.
So I'm stuck. Is this something I can fix outside of getting graalvm's source and taking a crack at it?
Upvotes: 1
Views: 1316
Reputation: 15870
I switched from GraalVM's Java 8 build to their Java 11 build, gu install native-image
, and now my helloworld
converted to a native image just fine when done from the aforementioned VS2017 command prompt.
Upvotes: 1