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

[native-image] Using java.util.prefs currently not supported for native-image generation #2063

Closed
fomalsd opened this issue Jan 12, 2020 · 17 comments
Assignees

Comments

@fomalsd
Copy link

fomalsd commented Jan 12, 2020

Native image compiler crashes on macOS 10.14.6 after write: stage

Build on Server(pid: 9682, port: 53433)*
[marytts-runtime-compact:9682]    classlist:   5,026.15 ms
[marytts-runtime-compact:9682]        (cap):   3,964.54 ms
[marytts-runtime-compact:9682]        setup:   5,020.82 ms
[marytts-runtime-compact:9682]   (typeflow):  11,249.14 ms
[marytts-runtime-compact:9682]    (objects):   8,284.06 ms
[marytts-runtime-compact:9682]   (features):   2,839.44 ms
[marytts-runtime-compact:9682]     analysis:  23,022.55 ms
[marytts-runtime-compact:9682]     (clinit):     565.27 ms
[marytts-runtime-compact:9682]     universe:   1,297.31 ms
[marytts-runtime-compact:9682]      (parse):   1,557.33 ms
[marytts-runtime-compact:9682]     (inline):   5,843.16 ms
[marytts-runtime-compact:9682]    (compile):  20,556.75 ms
[marytts-runtime-compact:9682]      compile:  29,614.76 ms
[marytts-runtime-compact:9682]        image:   3,640.96 ms
[marytts-runtime-compact:9682]        write:     523.28 ms
Fatal error: java.lang.RuntimeException: java.lang.RuntimeException: host C compiler or linker does not seem to work: java.lang.RuntimeException: returned 1

Running command: cc -v -o /Users/user/Downloads/marytts-runtime-compact -Wl,-no_compact_unwind -Wl,-exported_symbols_list -Wl,/var/folders/cs/4zbd2ql54ng_dp6ydx_8yqkc0000gp/T/SVM-7185506176963130683/exported_symbols.list -Wl,-x -arch x86_64 -L/var/folders/cs/4zbd2ql54ng_dp6ydx_8yqkc0000gp/T/SVM-7185506176963130683 -L/Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib -L/Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64 /var/folders/cs/4zbd2ql54ng_dp6ydx_8yqkc0000gp/T/SVM-7185506176963130683/marytts-runtime-compact.o /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libzip.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libnet.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libjava.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libnio.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/libffi.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/liblibchelper.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/libjvm.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/libstrictmath.a -lm -Wl,-framework,CoreFoundation -lpthread -ldl -lz

Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o /Users/user/Downloads/marytts-runtime-compact -L/var/folders/cs/4zbd2ql54ng_dp6ydx_8yqkc0000gp/T/SVM-7185506176963130683 -L/Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib -L/Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64 -no_compact_unwind -exported_symbols_list /var/folders/cs/4zbd2ql54ng_dp6ydx_8yqkc0000gp/T/SVM-7185506176963130683/exported_symbols.list -x /var/folders/cs/4zbd2ql54ng_dp6ydx_8yqkc0000gp/T/SVM-7185506176963130683/marytts-runtime-compact.o /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libzip.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libnet.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libjava.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/libnio.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/libffi.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/liblibchelper.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/libjvm.a /Users/user/graalvm-ce-java8-19.3.1/Contents/Home/jre/lib/svm/clibraries/darwin-amd64/libstrictmath.a -lm -framework CoreFoundation -lpthread -ldl -lz -L/usr/local/lib -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "_Java_java_util_prefs_MacOSXPreferencesFile_addChildToNode", referenced from:
      ___svm_cglobaldata_base in marytts-runtime-compact.o
  "_Java_java_util_prefs_MacOSXPreferencesFile_addNode", referenced from:
      ___svm_cglobaldata_base in marytts-runtime-compact.o
  "_Java_java_util_prefs_MacOSXPreferencesFile_getChildrenForNode", referenced from:
      ___svm_cglobaldata_base in marytts-runtime-compact.o
  "_Java_java_util_prefs_MacOSXPreferencesFile_getKeyFromNode", referenced from:
      ___svm_cglobaldata_base in marytts-runtime-compact.o
  "_Java_java_util_prefs_MacOSXPreferencesFile_getKeysForNode", referenced from:
      ___svm_version_info in marytts-runtime-compact.o
  "_Java_java_util_prefs_MacOSXPreferencesFile_synchronize", referenced from:
      ___svm_cglobaldata_base in marytts-runtime-compact.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
	at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:462)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:315)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:454)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.executeCompilation(NativeImageBuildServer.java:402)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.lambda$processCommand$8(NativeImageBuildServer.java:339)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.withJVMContext(NativeImageBuildServer.java:420)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.processCommand(NativeImageBuildServer.java:336)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.processRequest(NativeImageBuildServer.java:280)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.lambda$serve$7(NativeImageBuildServer.java:240)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: host C compiler or linker does not seem to work: java.lang.RuntimeException: returned 1

Reproduction:

marytts-runtime-compact.jar.zip – unzip first
Compile with:
/graalvm-ce-java8-19.3.1/Contents/Home/bin/native-image --no-fallback --allow-incomplete-classpath --report-unsupported-elements-at-runtime -jar /marytts-runtime-compact.jar

@fomalsd
Copy link
Author

fomalsd commented Jan 12, 2020

Likely related:
#2015, #1920

@xzel23
Copy link

xzel23 commented Jan 12, 2020

I think this is a duplicate of gluonhq/substrate#237. The Preferences API was missing from in SubstrateVM. This has been fixed in the latest build as noted in above issue. However, I still get a linker error for which I have opened another issue: gluonhq/substrate#260.

@fomalsd
Copy link
Author

fomalsd commented Jan 15, 2020

Getting identical behaviour on 19.3.1; updating the attached log and renaming the issue

@fomalsd fomalsd changed the title [native-image] "linker does not seem to work" with GraalVM CE 19.3.0.2 (Java8) on macOS 10.14.6 [native-image] "linker does not seem to work" with GraalVM CE 19.3.1 (Java8) on macOS 10.14.6 Jan 15, 2020
@fomalsd
Copy link
Author

fomalsd commented Jan 17, 2020

@xzel23 how did you manage to verify that those changes worked? Do you have any clues on how to build SubstrateVM (native-image in particular) from source yourself? Couldn't find any info on actual building. Also I don't quite understand the relationship between Oracle's native-image/SubstrateVM and Gluon's "substrate", I guess the latter one is a fork

@xzel23
Copy link

xzel23 commented Jan 18, 2020

@fomalsd First of all I use the Gluon client plugin for building. It makes it easier to create native images by offering a maven task. It downloads a copy of substrateVM to your system that's used later on. When I started, I had the exact same error messages that you have here. I used verbose output to see the linker flags, then tried to locate the libraries that were being linked. Using nm I could see that _Java_java_util_prefs_MacOSXPreferencesFile_* are all defined in libprefs (which was missing from the linker command). So I cloned the substrate project from gluonhq, patched it to add libprefs to the linker command, cloned the plugin and patched it to use my own version of substrate, compiled everything and then tried my own project again and the link errors were gone.

In the meantime, a new version (0.0.4) of the plugin has been released that pulls in a substrate version that fixes this issue, so I use that one.

Since you are not using the plugin, you could either give it a try, or try building your own version. You can see the linker flags that added the preferences API in this commit: gluonhq/substrate@7cf89b0.

I am also not 100% sure about the exact relationship between gluon and Graal, but I think they use substrate as a base and build their substrateVM on top of that is able to run JavaFX applications. Not everything is supported yet, i.e. I am currently stuck at javafx.web and javafx.media, but it's advancing steadily.

@fomalsd
Copy link
Author

fomalsd commented Feb 11, 2020

Any news? It appears that fix is as trivial as this:
https://github.com/gluonhq/substrate/pull/242/files

@olpaw
Copy link
Member

olpaw commented Feb 11, 2020

ATM, we don't have any explicit support for JVM libprefs library (java.util.prefs.*). Do you know which parts of your code depend on it?

@fomalsd
Copy link
Author

fomalsd commented Feb 11, 2020

Not really, I'm just trying to convert a jar of marytts:
https://github.com/marytts/marytts

Searching through their repository did not reveal any prefs-related code.
However I found this line from commons-lang lib when analysing all dependencies that ended up in a jar:
https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/SystemUtils.java#L474-L475

@sbrannen
Copy link

sbrannen commented Mar 6, 2020

Still experiencing this issue with GraalVM 20.0.

See https://github.com/sbrannen/graalvm-playground/tree/master/preferences

Preferences may be used by projects using the Spring Framework's PreferencesPlaceholderConfigurer.

Note, however, that PreferencesPlaceholderConfigurer is deprecated in the most recent releases of the Spring Framework.

@pisto
Copy link

pisto commented Mar 23, 2020

pinging on this.

@timmattison
Copy link
Contributor

Running into the same issue here. Even tried copying the class and building it into my project and it still fails. I can build some native-images for really basic projects but there's some dependency that lots of larger projects use that ends up triggering this.

@timmattison
Copy link
Contributor

Just updated to 20.1 and still getting the same issue. My log output looks like this:

Linker command executed:
/usr/bin/cc -Wl,-no_compact_unwind -Wl,-exported_symbols_list -Wl,/var/folders/9c/tpt08_m11dx1rfdl906jcdyn5l_v81/T/SVM-16866503176835518482/exported_symbols.list -Wl,-x -arch x86_64 -o /Users/timmatt/Dropbox/github/aws-iot-client/com.awslabs.iot.client.applications.awsiotclientconsole /var/folders/9c/tpt08_m11dx1rfdl906jcdyn5l_v81/T/SVM-16866503176835518482/com.awslabs.iot.client.applications.awsiotclientconsole.o /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/liblibchelper.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libnet.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libstrictmath.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libffi.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libdarwin.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libextnet.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libnio.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libjava.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libjvm.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libzip.a -v -L/var/folders/9c/tpt08_m11dx1rfdl906jcdyn5l_v81/T/SVM-16866503176835518482 -L/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib -L/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64 -Wl,-framework,CoreServices -lpthread -Wl,-framework,Foundation -ldl -lz

Linker command ouput:
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o /Users/timmatt/Dropbox/github/aws-iot-client/com.awslabs.iot.client.applications.awsiotclientconsole -L/var/folders/9c/tpt08_m11dx1rfdl906jcdyn5l_v81/T/SVM-16866503176835518482 -L/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib -L/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64 -no_compact_unwind -exported_symbols_list /var/folders/9c/tpt08_m11dx1rfdl906jcdyn5l_v81/T/SVM-16866503176835518482/exported_symbols.list -x /var/folders/9c/tpt08_m11dx1rfdl906jcdyn5l_v81/T/SVM-16866503176835518482/com.awslabs.iot.client.applications.awsiotclientconsole.o /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/liblibchelper.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libnet.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libstrictmath.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libffi.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libdarwin.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libextnet.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libnio.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libjava.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/svm/clibraries/darwin-amd64/libjvm.a /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home/lib/libzip.a -framework CoreServices -lpthread -framework Foundation -ldl -lz -L/usr/local/lib -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "_Java_java_util_prefs_MacOSXPreferencesFile_addNode", referenced from:
      ___svm_vm_target_ccompiler in com.awslabs.iot.client.applications.awsiotclientconsole.o
  "_Java_java_util_prefs_MacOSXPreferencesFile_synchronize", referenced from:
      ___svm_vm_target_platform in com.awslabs.iot.client.applications.awsiotclientconsole.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

	at com.oracle.svm.hosted.image.NativeBootImageViaCC.handleLinkerFailure(NativeBootImageViaCC.java:423)
	at com.oracle.svm.hosted.image.NativeBootImageViaCC.write(NativeBootImageViaCC.java:398)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:663)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1

@itspa1
Copy link

itspa1 commented Jun 19, 2020

hey, my error seems to be the same, although it's not on MAC, but on Linux, and I've updated to the 20.1.0 but still get the error, because of multiple dependency jar's that I use depend on java.util.preferences.*


Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-966467092219507350/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /home/peekay/syook/insite-java-gateway/target/insite.init /tmp/SVM-966467092219507350/insite.init.o /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/peekay/graalVM/lib/libnet.a /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/libstrictmath.a /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/libffi.a /home/peekay/graalVM/lib/libextnet.a /home/peekay/graalVM/lib/libnio.a /home/peekay/graalVM/lib/libjava.a /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/libjvm.a /home/peekay/graalVM/lib/libzip.a -v -L/tmp/SVM-966467092219507350 -L/home/peekay/graalVM/lib -L/home/peekay/graalVM/lib/svm/clibraries/linux-amd64 -lpthread -ldl -lz -lrt 

Linker command ouput:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/peekay/syook/insite-java-gateway/target/insite.init' '-v' '-L/tmp/SVM-966467092219507350' '-L/home/peekay/graalVM/lib' '-L/home/peekay/graalVM/lib/svm/clibraries/linux-amd64' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccpLtbzJ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o /home/peekay/syook/insite-java-gateway/target/insite.init -z noexecstack /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/tmp/SVM-966467092219507350 -L/home/peekay/graalVM/lib -L/home/peekay/graalVM/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. --gc-sections --dynamic-list /tmp/SVM-966467092219507350/exported_symbols.list --exclude-libs ALL -x /tmp/SVM-966467092219507350/insite.init.o /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/peekay/graalVM/lib/libnet.a /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/libstrictmath.a /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/libffi.a /home/peekay/graalVM/lib/libextnet.a /home/peekay/graalVM/lib/libnio.a /home/peekay/graalVM/lib/libjava.a /home/peekay/graalVM/lib/svm/clibraries/linux-amd64/libjvm.a /home/peekay/graalVM/lib/libzip.a -lpthread -ldl -lz -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: /tmp/SVM-966467092219507350/insite.init.o:(.data+0x7a0): undefined reference to `Java_java_util_prefs_FileSystemPreferences_chmod'
collect2: error: ld returned 1 exit status

	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:600)
	at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:463)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:359)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:518)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.executeCompilation(NativeImageBuildServer.java:406)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.lambda$processCommand$8(NativeImageBuildServer.java:343)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.withJVMContext(NativeImageBuildServer.java:424)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.processCommand(NativeImageBuildServer.java:340)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.processRequest(NativeImageBuildServer.java:284)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.lambda$serve$7(NativeImageBuildServer.java:244)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

any help would be appreciated.

@olpaw olpaw changed the title [native-image] "linker does not seem to work" with GraalVM CE 19.3.1 (Java8) on macOS 10.14.6 [native-image] Using java.util.prefs currently not supported for native-image generation Jun 22, 2020
@gradinac
Copy link
Contributor

gradinac commented Jul 24, 2020

Hey everyone!
As of b04d3d3, java.util.prefs support has been added to JDK 11 for all platforms.
For JDK 8, it should work with Windows and Linux. For Darwin on JDK 8, we will need to compile one of the missing static JDK libraries.

If you are not running on Darwin + JDK 8, give this a shot and post a comment of how it goes. @fomalsd, as you were hitting this issue on Darwin + JDK 8, I will post an update once we build the missing library.

Note: this will not be in the 20.2 release, so the only way to test it would be by building Graal from the master branch

Edit: It seems like a nightly build with the patch included is now available at https://github.com/graalvm/graalvm-ce-dev-builds/releases, you can also download it from there and try it out

@t3rmian
Copy link

t3rmian commented Sep 13, 2020

I can confirm that GraalVM CE 20.3.0-dev-20200912_0211 (graalvm-ce-java11-linux-amd64-dev) fixed the issue for me at least. With 20.2.0 for the same arch, I was getting linker errors with undefined references to Java_java_util_prefs_FileSystemPreferences.

@gradinac
Copy link
Contributor

@t3rmian Thank you for checking this out, I'm glad that it solved it!
As the original problem was for JDK 8 on Darwin, I will keep this issue open as that's the only platform - Java version combination that this fix doesn't work for.

@olpaw
Copy link
Member

olpaw commented Oct 6, 2020

@gradinac kindly fixed this on master.

@olpaw olpaw closed this as completed Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants