-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Graal reported an error when I tried to generate a native image for this simple example:
public class Main {
public interface LibC {
int printf(String fmt, Object... args);
}
public static void main(String[] args) {
LibC libc = LibraryLoader.create(LibC.class).load("c");
libc.printf("Hello, World!\n");
}
}
glavo@glavo:~/IdeaProjects/JNRTest/build/libs$ /opt/graalvm/graalvm-ce-1.0.0-rc4/bin/native-image -jar JNRTest-1.0-SNAPSHOT.jar
Build on Server(pid: 5476, port: 45611)*
classlist: 1,155.06 ms
(cap): 1,708.10 ms
setup: 3,036.95 ms
analysis: 8,199.65 ms
error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option -H:+ReportUnsupportedElementsAtRuntime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option -H:+ReportUnsupportedElementsAtRuntime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
at parsing jnr.ffi.provider.jffi.AsmClassLoader.defineClass(AsmClassLoader.java:39)
Call path from entry point to jnr.ffi.provider.jffi.AsmClassLoader.defineClass(String, byte[]):
at jnr.ffi.provider.jffi.AsmClassLoader.defineClass(AsmClassLoader.java:39)
at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:235)
at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:89)
at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:44)
at jnr.ffi.LibraryLoader.load(LibraryLoader.java:325)
at jnr.ffi.LibraryLoader.load(LibraryLoader.java:304)
at org.glavo.Main.main(Main.java:11)
at com.oracle.svm.reflect.proxies.Proxy_1_Main_main.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:173)
at com.oracle.svm.core.code.CEntryPointCallStubs.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
Error: Processing image build request failed
taig and huahaiytisonkun