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

Provide a natively compiled version #241

Open
apupier opened this issue Jun 20, 2019 · 3 comments
Open

Provide a natively compiled version #241

apupier opened this issue Jun 20, 2019 · 3 comments

Comments

@apupier
Copy link
Member

apupier commented Jun 20, 2019

Issue informations

currently, a springboot jar is provided. In cloud environment, Ram used is often constrained (sic). If we can provide a native version that can be launched inside Eclipse Che at least, it should improve RAM usage.

see GraalVM https://www.graalvm.org/docs/reference-manual/aot-compilation/

apupier added a commit to apupier/camel-language-server that referenced this issue Aug 2, 2019
- needs to specify -H:+TempFile= because of
oracle/graal#1562
- needs to use a x64 version
- needs to comment out springboot-maven-plugin for now, otherwise
mainclass is not found

still errors for now

Signed-off-by: Aurélien Pupier <[email protected]>
@apupier
Copy link
Member Author

apupier commented Aug 2, 2019

using this branch and building from a "Visual C++ 2015 x86 x64 Cross Built Tools" command prompt, it is reporting these things to configure:

Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.helpers.OptionConverter.class$(OptionConverter.java:220)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.helpers.Loader.class$(Loader.java:106)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.CategoryKey.class$(CategoryKey.java:47)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.Category.class$(Category.java:118)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.Logger.class$(Logger.java:35)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.helpers.Loader.loadClass(Loader.java:182)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.or.RendererMap.class$(RendererMap.java:53)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.PropertyConfigurator.class$(PropertyConfigurator.java:605)
Warning: Reflection method java.lang.Class.forName invoked at org.apache.log4j.config.PropertySetter.class$(PropertySetter.java:142)
Warning: Reflection method java.lang.Class.newInstance invoked at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:337)
Warning: Reflection method java.lang.Class.getMethod invoked at org.apache.log4j.helpers.OptionConverter.toLevel(OptionConverter.java:223)
Warning: Reflection method java.lang.Class.getMethod invoked at org.apache.log4j.helpers.Loader.getTCL(Loader.java:160)
Warning: Reflection method java.lang.Class.getMethods invoked at org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.validate(ReflectiveMessageValidator.java:137)
Warning: Reflection method java.lang.Class.getDeclaredMethods invoked at org.eclipse.lsp4j.jsonrpc.services.AnnotationUtil.findRpcMethods(AnnotationUtil.java:63)
Warning: Reflection method java.lang.Class.getDeclaredMethods invoked at org.eclipse.lsp4j.jsonrpc.services.AnnotationUtil.findDelegateSegments(AnnotationUtil.java:30)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.eclipse.lsp4j.jsonrpc.json.adapters.ThrowableTypeAdapter.read(ThrowableTypeAdapter.java:81)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at com.google.gson.internal.ConstructorConstructor.newDefaultConstructor(ConstructorConstructor.java:99)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.eclipse.lsp4j.jsonrpc.json.adapters.ThrowableTypeAdapter.read(ThrowableTypeAdapter.java:87)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.eclipse.lsp4j.jsonrpc.json.adapters.ThrowableTypeAdapter.read(ThrowableTypeAdapter.java:84)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.eclipse.lsp4j.jsonrpc.json.adapters.CollectionTypeAdapter$Factory.getConstructor(CollectionTypeAdapter.java:70)
Warning: Reflection method java.lang.Class.getDeclaredConstructor invoked at org.eclipse.lsp4j.jsonrpc.json.adapters.ThrowableTypeAdapter.read(ThrowableTypeAdapter.java:90)
Warning: Reflection method java.lang.Class.getField invoked at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.<init>(TypeAdapters.java:797)
Warning: Reflection method java.lang.Class.getDeclaredFields invoked at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:150)
Warning: Reflection method java.lang.ClassLoader.loadClass invoked at org.apache.log4j.helpers.Loader.loadClass(Loader.java:185)
Warning: Aborting stand-alone image build due to reflection use without configuration.

and there is another error after, I hope it is due to the previous configuration (but to investigate):

net.lib(NetworkInterface_winXP.obj) : error LNK2001: unresolved external symbol __imp_sprintf
java.lib(Console_md.obj) : error LNK2001: unresolved external symbol __imp_sprintf
net.lib(TwoStacksPlainDatagramSocketImpl.obj) : error LNK2001: unresolved external symbol __imp_sprintf
net.lib(ResolverConfigurationImpl.obj) : error LNK2001: unresolved external symbol __imp_sprintf
net.lib(net_util_md.obj) : error LNK2001: unresolved external symbol __imp_sprintf
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(NetworkInterface.obj) : error LNK2019: unresolved external symbol __imp__snprintf_s referenced in function enumInterfaces
net.lib(net_util_md.obj) : error LNK2019: unresolved external symbol __imp_printf referenced in function dumpAddr
jvm.lib(JvmFuncs.obj) : error LNK2001: unresolved external symbol __imp_printf
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
C:\git\camel-language-server\target\CamelLanguageServer.exe : fatal error LNK1120: 8 unresolved externals

nota:

apupier added a commit to apupier/camel-language-server that referenced this issue Aug 2, 2019
@apupier
Copy link
Member Author

apupier commented Aug 2, 2019

first batch of warning "fixed" in branch. Will need to test at runtime.
it will be interesting to launch with agent on test suite https://github.com/oracle/graal/blob/master/substratevm/CONFIGURE.md#assisted-configuration-of-native-image-builds (but nto available on Windows)

The second set of issues is related to a 32 bit C++ build tools compiler used.

Several issues on windows, for reference:

requires Visual Studio 2010 PRO and Visual Studio SDK 2010

cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64
vcvars64.bat
cd C:\git\camel-language-server
mvn install -DskipTests

currently seems blocked by:
oracle/graal#1484

java.lib(SecurityManager.obj) : error LNK2019: unresolved external symbol JVM_GetClassContext referenced in function Java_java_lang_SecurityManager_getClassContext
java.lib(SecurityManager.obj) : error LNK2019: unresolved external symbol JVM_CurrentLoadedClass referenced in function Java_java_lang_SecurityManager_currentLoadedClass0
java.lib(SecurityManager.obj) : error LNK2019: unresolved external symbol JVM_CurrentClassLoader referenced in function Java_java_lang_SecurityManager_currentClassLoader0
java.lib(SecurityManager.obj) : error LNK2019: unresolved external symbol JVM_ClassDepth referenced in function Java_java_lang_SecurityManager_classDepth
java.lib(SecurityManager.obj) : error LNK2019: unresolved external symbol JVM_ClassLoaderDepth referenced in function Java_java_lang_SecurityManager_classLoaderDepth0

Might be Windows only issue

@apupier
Copy link
Member Author

apupier commented Aug 2, 2019

From Leandro Del Sole on gitter chat about the SecurityManager error:

"I was building a java native image and needed this same libsunec.so to be able to use AWS SDK. I got this from Linux OpenJDK 11 and it worked for my case"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant