DatL4g / KCEF

Kotlin implementation of jcefmaven with more modern setup and depending on JetBrains/jcef
https://datl4g.github.io/KCEF/
Apache License 2.0
48 stars 8 forks source link

Loading native library from incorrect path when using rendering = CefRendering.OFFSCREEN #5

Open itboy87 opened 10 months ago

itboy87 commented 10 months ago

When I use rendering = CefRendering.OFFSCREEN it is crashing client.createBrowser(content, rendering = CefRendering.OFFSCREEN)

It try to load from /IdeaProjects/testapp/natives/macosx-universal/gluegen_rt but correct path is /IdeaProjects/testapp/kcef-bundle/gluegen_rt

kcef-bundle is the install dir for KCEF.init

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load library: /IdeaProjects/testapp/natives/macosx-universal/gluegen_rt at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398) at java.base/java.lang.Runtime.load0(Runtime.java:755) at java.base/java.lang.System.load(System.java:1953) at gluegen.rt/com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:625) at gluegen.rt/com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64) at gluegen.rt/com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107) at gluegen.rt/com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488) at gluegen.rt/com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427) at gluegen.rt/com.jogamp.common.os.Platform$1.run(Platform.java:321) at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) at gluegen.rt/com.jogamp.common.os.Platform.<clinit>(Platform.java:290) at jogl.all/com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154) at jcef/org.cef.browser.CefBrowserOsr.createGLCanvas(CefBrowserOsr.java:140) at jcef/org.cef.browser.CefBrowserOsr.<init>(CefBrowserOsr.java:98) at jcef/org.cef.browser.CefBrowserOsr.<init>(CefBrowserOsr.java:90) at jcef/org.cef.browser.CefBrowserFactory.create(CefBrowserFactory.java:35) at jcef/org.cef.CefClient.createBrowser(CefClient.java:172) at jcef/org.cef.CefClient.createBrowser(CefClient.java:165) at dev.datlag.kcef.KCEFClient.createBrowser(KCEFClient.kt:70) at dev.datlag.kcef.KCEFClient.createBrowser$default(KCEFClient.kt:66) at ui.common.webview.WebViewLayoutV2Kt$WebViewLayoutV2$1.invoke(WebViewLayoutV2.kt:30) at ui.common.webview.WebViewLayoutV2Kt$WebViewLayoutV2$1.invoke(WebViewLayoutV2.kt:24) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at ui.common.webview.WebViewLayoutV2Kt.WebViewInit(WebViewLayoutV2.kt:68) at ui.common.webview.WebViewLayoutV2Kt.WebViewLayoutV2(WebViewLayoutV2.kt:24) at ui.screens.AboutScreenKt$AboutScreen$2.invoke(AboutScreen.kt:55) at ui.screens.AboutScreenKt$AboutScreen$2.invoke(AboutScreen.kt:32) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at androidx.compose.material.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:588) at androidx.compose.material.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:570) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:989) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:476) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:33) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3303) at androidx.compose.runtime.ComposerImpl.composeContent$runtime(Composer.kt:3236) at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:723) at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1071) at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime(Composer.kt:3600) at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:631) at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:617) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:499) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:471) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:462) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:446) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:871) at androidx.compose.material.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke-0kLqBqw(Scaffold.kt:570) at androidx.compose.material.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke(Scaffold.kt:452) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:708) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:252) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:251) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2304) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:504) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:260) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133) at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1613) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:36) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:620) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:596) at androidx.compose.foundation.layout.BoxMeasurePolicy.measure-3p2s80s(Box.kt:122) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126) at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:252) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:251) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2304) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:504) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:260) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133) at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1613) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:36) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:620) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:596) at androidx.compose.foundation.layout.BoxMeasurePolicy.measure-3p2s80s(Box.kt:122) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126) at androidx.compose.foundation.layout.FillNode.measure-3p2s80s(Size.kt:699) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:252) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:251) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2304) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:504) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:260) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133) at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1613) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:36) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:620) at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui(LayoutNode.kt:1144) at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui$default(LayoutNode.kt:1135) at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:356) at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:514) at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded$default(MeasureAndLayoutDelegate.kt:491) at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(MeasureAndLayoutDelegate.kt:377) at androidx.compose.ui.node.RootNodeOwner$OwnerImpl.measureAndLayout(RootNodeOwner.skiko.kt:289) at androidx.compose.ui.node.RootNodeOwner.measureAndLayout(RootNodeOwner.skiko.kt:187) at androidx.compose.ui.scene.MultiLayerComposeSceneImpl.measureAndLayout(MultiLayerComposeScene.skiko.kt:246) at androidx.compose.ui.scene.BaseComposeScene.doLayout(BaseComposeScene.skiko.kt:211) at androidx.compose.ui.scene.BaseComposeScene.access$doLayout(BaseComposeScene.skiko.kt:51) at androidx.compose.ui.scene.BaseComposeScene.render(BaseComposeScene.skiko.kt:152) at androidx.compose.ui.scene.ComposeSceneMediator$DesktopSkikoView.onRender(ComposeSceneMediator.desktop.kt:490) at org.jetbrains.skiko.SkiaLayer.update$skiko(SkiaLayer.awt.kt:548) at org.jetbrains.skiko.redrawer.AWTRedrawer.update(AWTRedrawer.kt:54) at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invokeSuspend(MetalRedrawer.kt:82) at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt) at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt) at org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(FrameDispatcher.kt:33) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@128923f0, SwingDispatcher@51e6b362] JCEF_V(14:27:903): CefBrowser_N: org.cef.browser.CefBrowserOsr@1927a31e: native part of browser wasn't created yet, browser will be closed immediately after creation

vickyleu commented 8 months ago

same

dimaklekchyan commented 8 months ago

To avoid this bug I changed jdk to jbrsdk_jcef-17. But than I ran into an error on mac os with M1

2024-03-27 12:37:48.599 java[20363:662769] Expected NSWindow, found (null)
2024-03-27 12:37:48.744 java[20363:662769] -[__NSSingleObjectSetI addAction:]: unrecognized selector sent to instance 0x600009e8b6e0
2024-03-27 12:37:48.766 java[20363:662769] Exception in NSApplicationAWT:
 -[__NSSingleObjectSetI addAction:]: unrecognized selector sent to instance 0x600009e8b6e0
0   CoreFoundation                      0x00007ff80a8e4b72 __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x00007ff80a40c41c objc_exception_throw + 48
2   CoreFoundation                      0x00007ff80a9805c2 -[NSObject(NSObject) __retain_OA] + 0
3   CoreFoundation                      0x00007ff80a851213 ___forwarding___ + 1392
4   CoreFoundation                      0x00007ff80a850c18 _CF_forwarding_prep_0 + 120
5   AppKit                              0x00007ff80e371031 -[NSWMWindowCoordinator performTransactionUsingBlock:] + 123
6   AppKit                              0x00007ff80e1bdbdd -[NSWindow(NSWMWindowManagement) window:didUpdateWithChangedProperties:] + 84
7   WindowManagement                    0x00007ffb26facf8b -[_WMWindow performUpdatesUsingBlock:] + 107
8   AppKit                              0x00007ff80d8b8fe2 -[NSWindow _oldPlaceWindow:fromServer:] + 354
9   AppKit                              0x00007ff80d8b7c52 -[NSWindow _setFrameCommon:display:fromServer:] + 3089
10  AppKit                              0x00007ff80d9ce51e -[NSWindow _setFrameAfterMove:] + 1141
11  AppKit                              0x00007ff80e1aa308 -[NSWindow _windowMovedToRect:dueToMoveEvent:] + 191
12  AppKit                              0x00007ff80d9cdea9 -[NSWindow _windowMoved:] + 1098
13  AppKit                              0x00007ff80d9cda3d -[NSWindow _internalHandleAppKitDefinedEvent:] + 239
14  AppKit                              0x00007ff80d9cd733 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 576
15  AppKit                              0x00007ff80d9cd2d7 -[NSWindow(NSEventRouting) sendEvent:] + 345
16  AppKit                              0x00007ff80d9cc3df -[NSApplication(NSEvent) sendEvent:] + 2183
17  libjcef.dylib                       0x0000000139356391 -[NSApplication(JCEFApplication) _swizzled_sendEvent:] + 97
18  libosxapp.dylib                     0x000000010a40cc81 -[NSApplicationAWT sendEvent:] + 497
19  AppKit                              0x00007ff80dc865fe -[NSApplication _handleEvent:] + 65
20  AppKit                              0x00007ff80d85b65d -[NSApplication run] + 623
21  libosxapp.dylib                     0x000000010a40c765 +[NSApplicationAWT runAWTLoopWithApp:] + 165
22  libawt_lwawt.dylib                  0x0000000130d97ef0 +[AWTStarter starter:headless:] + 496
23  libosxapp.dylib                     0x000000010a40e92f +[ThreadUtilities invokeBlockCopy:] + 15
24  Foundation                          0x00007ff80b679743 __NSThreadPerformPerform + 177
25  CoreFoundation                      0x00007ff80a86e8a6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26  CoreFoundation                      0x00007ff80a86e849 __CFRunLoopDoSource0 + 157
27  CoreFoundation                      0x00007ff80a86e626 __CFRunLoopDoSources0 + 217
28  CoreFoundation                      0x00007ff80a86d2aa __CFRunLoopRun + 916
29  CoreFoundation                      0x00007ff80a86c8bc CFRunLoopRunSpecific + 560
30  libjli.dylib                        0x0000000109489212 CreateExecutionEnvironment + 386
31  libjli.dylib                        0x0000000109484f8d JLI_Launch + 1389
32  java                                0x0000000100eeac0a main + 394
33  dyld                                0x000000020119741f start + 1903