temurin-build: Native Libraries cannot be loaded with 11.0.4 on Mojave

Platform:

OSX Mojave

Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64

Architecture:

x86_64

Issue description

When attempting to load native libraries on the above platform with any of the 11.0.4 builds, I get an exception:

/private/var/folders/f6/c8gfypz56c5d9b66l6_1n30m0000gn/T/native-platform4313193693498570932dir/libnative-platform.dylib: code signature in (/private/var/folders/f6/c8gfypz56c5d9b66l6_1n30m0000gn/T/native-platform4313193693498570932dir/libnative-platform.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

When running with 11.0.3, everything works as expected.

Reproducible test

There is a java app over here: https://bintray.com/beta/#/adammurdoch/maven/net.rubygrapefruit:native-platform-test/0.18?tab=files which tests various native calls.

If you download the zip, and unpack it, I get the following results:

11.0.3 (Good)

$ bin/native-platform-test

Select test to run:
  1) Show terminal details
  2) Show machine details
  3) Show file systems
  4) Test input handling
  5) Example prompts
> 6) Exit
Use the arrow keys to select an option and press enter

11.0.4 (Bad)

$ bin/native-platform-test
Exception in thread "main" net.rubygrapefruit.platform.NativeIntegrationLinkageException: Native library 'libnative-platform.dylib' could not be loaded for Mac OS X x86_64.
	at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:61)
	at net.rubygrapefruit.platform.Native.init(Native.java:55)
	at net.rubygrapefruit.platform.Native.get(Native.java:80)
	at net.rubygrapefruit.platform.test.Main.terminals(Main.java:286)
	at net.rubygrapefruit.platform.test.Main.main(Main.java:109)
Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/f6/c8gfypz56c5d9b66l6_1n30m0000gn/T/native-platform4313193693498570932dir/libnative-platform.dylib: dlopen(/private/var/folders/f6/c8gfypz56c5d9b66l6_1n30m0000gn/T/native-platform4313193693498570932dir/libnative-platform.dylib, 1): no suitable image found.  Did find:
	/private/var/folders/f6/c8gfypz56c5d9b66l6_1n30m0000gn/T/native-platform4313193693498570932dir/libnative-platform.dylib: code signature in (/private/var/folders/f6/c8gfypz56c5d9b66l6_1n30m0000gn/T/native-platform4313193693498570932dir/libnative-platform.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
	at java.base/java.lang.Runtime.load0(Runtime.java:767)
	at java.base/java.lang.System.load(System.java:1831)
	at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:51)
	... 4 more

I suspect this is an OS X only thing, but I’m testing it on ubuntu to make sure

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

@taubeklavs we have a fix in place for this and are in the process of creating a jdk-11.0.4+11.3 release. Apologies for the inconvenience

Doesn’t look like that build is out yet and issue was blocking something I’m working on – for anyone else in the same boat, you should be able to:

brew cask reinstall https://raw.githubusercontent.com/AdoptOpenJDK/homebrew-openjdk/c017a832eec4f940e11c139b6e7852eeb3b2aad8/Casks/adoptopenjdk11.rb

to get the adoptopenjdk11 cask to read out like so:

$ brew cask info adoptopenjdk11
adoptopenjdk11: 11,0.3:7
https://adoptopenjdk.net/
/usr/local/Caskroom/adoptopenjdk11/11,0.3:7 (181.4MB)
From: https://github.com/adoptopenjdk/homebrew-openjdk/blob/master/Casks/adoptopenjdk11.rb
==> Name
AdoptOpenJDK 11
==> Artifacts
OpenJDK11U-jdk_x64_mac_hotspot_11.0.3_7.pkg (Pkg)

Once the new build is published, simple brew cask upgrade should pick it up. 😃

Save erroneous behavior occurs with

openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.2+10)

I just downloaded jdk-12.0.2+10.2 and ran the native-platform-test. I got the “Bad” trace reported by OP.

Any hope to get a fixed build?

I have this problem with 14.0.1 and 11.0.7 on Catalina

@peter-gerhard There’s no hardened runtime and notarization support on OpenJDK 12 and there won’t be because it has reached its EOL.

Just checked the latest 11.0.5

openjdk version “11.0.5” 2019-10-15

And this all works on OS X 😎 🎉

Closing this

Thanks all!

I am also experiencing the same issue on macos with jdk-11.0.4+11.2, reverting to jdk-11.0.3+7 works.