hello guys. I’m trying to write a simple app with cljfx but faced with a blocker issue related to the JavaFX and Apple M1
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
I know it’s not related to cljfx directly but I’m struggling to find useful tutorials or guides on how to update JavaFX on my machine
I downloaded JavaFX 17-ea+8 from repo. How to tell JDK to use that version instead of .openjfx/cache ?
Would be really appreciate for some links. Thanks
in your dependency management file (proejct.clj or deps.edn), you should specify explicit dependencies on javafx
like what cljfx itself does https://github.com/cljfx/cljfx/blob/master/deps.edn#L2-L6
I’m using project.clj
but depend on the version you need
then it will be in a bit different syntax, e.g. [org.openjfx/javafx-controls "17-ea+8"]
let me try
so I updated libraries
error is still the same but refers to the new path
.openjfx/cache/17-ea/
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1953)
at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
at com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:62)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:51)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:833)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1953)
at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
at com.sun.prism.sw.SWPipeline.lambda$static$0(SWPipeline.java:42)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:833)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline founddo you use arm jdk?
is it possible that you launch this program using e.g. arm build of intellij idea that uses x64 jdk?
openjdk version “17.0.6” 2023-01-17 OpenJDK Runtime Environment Homebrew (build 17.0.6+0) OpenJDK 64-Bit Server VM Homebrew (build 17.0.6+0, mixed mode, sharing)
this is printed from java --version
I installed it with brew install openjdk@17
I choose this version in intellij
you might be right here
I tried lein repl and error seems to gone
or maybe not. lein repl starts but when I’m trying to render something it fails
2023-03-21 17:01:22.166 java[38812:8133311] *** Assertion failure in -[_NSTrackingAreaAKViewHelper removeTrackingRect:], _NSTrackingAreaAKManager.m:1613
2023-03-21 17:01:22.168 java[38812:8133311] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'So I switched to JDK 19.0.2 and javafx 20-ea+19 and now it works from lein repl. but still doesn’t work if I run repl from intellij
I think I can live with it for now. Thanks
Glad you got it working for you
We had this issue at work. It looks like a bug in cursive
maybe it because it still using rosetta?
but not sure
anyway, thank you
It seems cursive uses intellij's own arm JVM when calculating classpath, but in case of javafx the classpath depends on the JVM used to calculate classpath where it selects arm vs x64 dependencies to use
So far we found 2 workarounds: start the JVM from the terminal so the classpath is calculated using the same JVM, or use x64 idea — you can download it on their site