-
Notifications
You must be signed in to change notification settings - Fork 35
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
Update jna to 5.10.0 for arm64 support #141
Conversation
1e47087 is just here because the appveyor build is failing for what look like unrelated reasons, and that was the only way to provide a pre-built zip for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in the context of #149, without this PR almost all Zarr tests would fail with java.lang.NoClassDefFoundError
or java.lang.UnsatisfiedLinkError
exception.
With the new jna
version, both the utility and most Zarr tests are now passing as expected. The only remaining erros are the com.glencoesoftware.bioformats2raw.test.ZarrTest.testDownsampleTypes
tests which are still failing with
ZarrTest > testDownsampleTypes(Downsampling) > com.glencoesoftware.bioformats2raw.test.ZarrTest.testDownsampleTypes(Downsampling)[2] FAILED
picocli.CommandLine$ExecutionException at ZarrTest.java:94
Caused by: java.lang.RuntimeException at ZarrTest.java:94
Caused by: java.util.concurrent.CompletionException at CompletableFuture.java:331
Caused by: java.lang.UnsatisfiedLinkError at Mat.java:-2
ZarrTest > testDownsampleTypes(Downsampling) > com.glencoesoftware.bioformats2raw.test.ZarrTest.testDownsampleTypes(Downsampling)[3] FAILED
picocli.CommandLine$ExecutionException at ZarrTest.java:94
Caused by: java.lang.RuntimeException at ZarrTest.java:94
Caused by: java.util.concurrent.CompletionException at CompletableFuture.java:331
Caused by: java.lang.UnsatisfiedLinkError at Mat.java:-2
ZarrTest > testDownsampleTypes(Downsampling) > com.glencoesoftware.bioformats2raw.test.ZarrTest.testDownsampleTypes(Downsampling)[4] FAILED
picocli.CommandLine$ExecutionException at ZarrTest.java:94
Caused by: java.lang.RuntimeException at ZarrTest.java:94
Caused by: java.util.concurrent.CompletionException at CompletableFuture.java:331
Caused by: java.lang.UnsatisfiedLinkError at Mat.java:-2
ZarrTest > testDownsampleTypes(Downsampling) > com.glencoesoftware.bioformats2raw.test.ZarrTest.testDownsampleTypes(Downsampling)[5] FAILED
picocli.CommandLine$ExecutionException at ZarrTest.java:94
Caused by: java.lang.RuntimeException at ZarrTest.java:94
Caused by: java.util.concurrent.CompletionException at CompletableFuture.java:331
Caused by: java.lang.UnsatisfiedLinkError at Mat.java:-2
ZarrTest > testDownsampleTypes(Downsampling) > com.glencoesoftware.bioformats2raw.test.ZarrTest.testDownsampleTypes(Downsampling)[6] FAILED
picocli.CommandLine$ExecutionException at ZarrTest.java:94
Caused by: java.lang.RuntimeException at ZarrTest.java:94
Caused by: java.util.concurrent.CompletionException at CompletableFuture.java:331
Caused by: java.lang.UnsatisfiedLinkError at Mat.java:-2
Running the utility displays the following warnings but succeeds
(java_dev) sbesson@Sebastiens-MacBook-Pro bioformats2raw % ./bioformats2raw-0.4.1-SNAPSHOT/bin/bioformats2raw test.fake test.zarr
2022-04-28 15:45:44,539 [main] WARN c.g.bioformats2raw.OpenCVTools - Could not load OpenCV libraries
java.lang.ExceptionInInitializerError: null
at nu.pattern.OpenCV$LocalLoader.getInstance(OpenCV.java:307)
at nu.pattern.OpenCV.loadLocally(OpenCV.java:290)
at com.glencoesoftware.bioformats2raw.OpenCVTools.loadOpenCV(OpenCVTools.java:34)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:424)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:92)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2172)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2550)
at picocli.CommandLine.parseWithHandler(CommandLine.java:2485)
at picocli.CommandLine.call(CommandLine.java:2761)
at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:1937)
Caused by: java.lang.UnsupportedOperationException: Architecture "aarch64" is not supported.
at nu.pattern.OpenCV$Arch.getCurrent(OpenCV.java:91)
at nu.pattern.OpenCV.extractNativeBinary(OpenCV.java:316)
at nu.pattern.OpenCV.access$100(OpenCV.java:22)
at nu.pattern.OpenCV$LocalLoader.<init>(OpenCV.java:296)
at nu.pattern.OpenCV$LocalLoader.<init>(OpenCV.java:293)
at nu.pattern.OpenCV$LocalLoader$Holder.<clinit>(OpenCV.java:303)
... 15 common frames omitted
2022-04-28 15:45:44,542 [main] WARN c.g.bioformats2raw.OpenCVTools - Could not load native library opencv_java342
java.lang.UnsatisfiedLinkError: no opencv_java342 in java.library.path: [/Users/sbesson/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at com.glencoesoftware.bioformats2raw.OpenCVTools.loadOpenCV(OpenCVTools.java:41)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:424)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:92)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2172)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2550)
at picocli.CommandLine.parseWithHandler(CommandLine.java:2485)
at picocli.CommandLine.call(CommandLine.java:2761)
at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:1937)
2022-04-28 15:45:44,677 [main] WARN o.s.nativelib.NativeLibraryUtil - No native library available for this platform.
and using a different downsample type fails with an UnsatisfiedLinkError
(java_dev) sbesson@Sebastiens-MacBook-Pro bioformats2raw % ./bioformats2raw-0.4.1-SNAPSHOT/bin/bioformats2raw test.fake test.zarr --downsample-type CUBIC
2022-04-28 15:46:47,112 [main] WARN c.g.bioformats2raw.OpenCVTools - Could not load OpenCV libraries
java.lang.ExceptionInInitializerError: null
at nu.pattern.OpenCV$LocalLoader.getInstance(OpenCV.java:307)
at nu.pattern.OpenCV.loadLocally(OpenCV.java:290)
at com.glencoesoftware.bioformats2raw.OpenCVTools.loadOpenCV(OpenCVTools.java:34)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:424)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:92)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2172)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2550)
at picocli.CommandLine.parseWithHandler(CommandLine.java:2485)
at picocli.CommandLine.call(CommandLine.java:2761)
at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:1937)
Caused by: java.lang.UnsupportedOperationException: Architecture "aarch64" is not supported.
at nu.pattern.OpenCV$Arch.getCurrent(OpenCV.java:91)
at nu.pattern.OpenCV.extractNativeBinary(OpenCV.java:316)
at nu.pattern.OpenCV.access$100(OpenCV.java:22)
at nu.pattern.OpenCV$LocalLoader.<init>(OpenCV.java:296)
at nu.pattern.OpenCV$LocalLoader.<init>(OpenCV.java:293)
at nu.pattern.OpenCV$LocalLoader$Holder.<clinit>(OpenCV.java:303)
... 15 common frames omitted
2022-04-28 15:46:47,115 [main] WARN c.g.bioformats2raw.OpenCVTools - Could not load native library opencv_java342
java.lang.UnsatisfiedLinkError: no opencv_java342 in java.library.path: [/Users/sbesson/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at com.glencoesoftware.bioformats2raw.OpenCVTools.loadOpenCV(OpenCVTools.java:41)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:424)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:92)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2172)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2550)
at picocli.CommandLine.parseWithHandler(CommandLine.java:2485)
at picocli.CommandLine.call(CommandLine.java:2761)
at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:1937)
2022-04-28 15:46:47,253 [main] WARN o.s.nativelib.NativeLibraryUtil - No native library available for this platform.
2022-04-28 15:46:47,701 [pool-1-thread-2] ERROR c.g.bioformats2raw.Converter - Failure processing chunk; resolution=1 plane=0 xx=0 yy=0 zz=0 width=256 height=256 depth=1
java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:39)
at com.glencoesoftware.bioformats2raw.OpenCVTools.downsample(OpenCVTools.java:108)
at com.glencoesoftware.bioformats2raw.Converter.getTileDownsampled(Converter.java:937)
at com.glencoesoftware.bioformats2raw.Converter.getTile(Converter.java:971)
at com.glencoesoftware.bioformats2raw.Converter.processChunk(Converter.java:1072)
at com.glencoesoftware.bioformats2raw.Converter.lambda$saveResolutions$4(Converter.java:1286)
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)
2022-04-28 15:46:47,701 [main] ERROR c.g.bioformats2raw.Converter - Error while writing series 0
java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
at java.base/java.util.concurrent.CompletableFuture$BiRelay.tryFire(CompletableFuture.java:1423)
at java.base/java.util.concurrent.CompletableFuture$CoCompletion.tryFire(CompletableFuture.java:1144)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at com.glencoesoftware.bioformats2raw.Converter.lambda$saveResolutions$4(Converter.java:1294)
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.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:39)
at com.glencoesoftware.bioformats2raw.OpenCVTools.downsample(OpenCVTools.java:108)
at com.glencoesoftware.bioformats2raw.Converter.getTileDownsampled(Converter.java:937)
at com.glencoesoftware.bioformats2raw.Converter.getTile(Converter.java:971)
at com.glencoesoftware.bioformats2raw.Converter.processChunk(Converter.java:1072)
at com.glencoesoftware.bioformats2raw.Converter.lambda$saveResolutions$4(Converter.java:1286)
... 3 common frames omitted
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while calling command (com.glencoesoftware.bioformats2raw.Converter@53fe15ff): java.lang.RuntimeException: java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at picocli.CommandLine.executeUserObject(CommandLine.java:1962)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2172)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2550)
at picocli.CommandLine.parseWithHandler(CommandLine.java:2485)
at picocli.CommandLine.call(CommandLine.java:2761)
at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:1937)
Caused by: java.lang.RuntimeException: java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at com.glencoesoftware.bioformats2raw.Converter.unwrapException(Converter.java:1677)
at com.glencoesoftware.bioformats2raw.Converter.convert(Converter.java:650)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:477)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:92)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
... 9 more
Caused by: java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
at java.base/java.util.concurrent.CompletableFuture$BiRelay.tryFire(CompletableFuture.java:1423)
at java.base/java.util.concurrent.CompletableFuture$CoCompletion.tryFire(CompletableFuture.java:1144)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at com.glencoesoftware.bioformats2raw.Converter.lambda$saveResolutions$4(Converter.java:1294)
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.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat(int, int, int)'
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:39)
at com.glencoesoftware.bioformats2raw.OpenCVTools.downsample(OpenCVTools.java:108)
at com.glencoesoftware.bioformats2raw.Converter.getTileDownsampled(Converter.java:937)
at com.glencoesoftware.bioformats2raw.Converter.getTile(Converter.java:971)
at com.glencoesoftware.bioformats2raw.Converter.processChunk(Converter.java:1072)
at com.glencoesoftware.bioformats2raw.Converter.lambda$saveResolutions$4(Converter.java:1286)
... 3 more
The opencv
dependency suffers from the same architecture limitation as jna
- see also openpnp/opencv#81.
Unlike the jna
dependency, the impact is much more limited so I think merging this is already a significant improvement when working using an arm64
environment
See ome/ZarrReader#16
I expect this to be required for an arm64/aarch64 JDK on an M1 to pick up
libblosc.dylib
, see also #139.