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

conflict between Skiko and Skia.framework in iOS #953

Open
vickyleu opened this issue Jul 4, 2024 · 2 comments
Open

conflict between Skiko and Skia.framework in iOS #953

vickyleu opened this issue Jul 4, 2024 · 2 comments

Comments

@vickyleu
Copy link

vickyleu commented Jul 4, 2024

A necessary Skia dynamic library is used in a third-party library, with Skia version m121, while the version referenced in Skiko is m116-47d3027-1.

KMMCompose`SkCanvas::save:
    0x10465df3c <+0>:  ldr    w8, [x0, #0xc58]
    0x10465df40 <+4>:  add    w9, w8, #0x1
    0x10465df44 <+8>:  str    w9, [x0, #0xc58]
    0x10465df48 <+12>: ldr    x9, [x0, #0xc40]
->  0x10465df4c <+16>: ldr    w10, [x9, #0x58]  ## Thread 1: EXC_BAD_ACCESS (code=1, address=0x58)
    0x10465df50 <+20>: add    w10, w10, #0x1
    0x10465df54 <+24>: str    w10, [x9, #0x58]
    0x10465df58 <+28>: mov    x0, x8
    0x10465df5c <+32>: ret    

trace

#0	0x000000010465df4c in SkCanvas::save() ()
#1	0x0000000102939744 in kfun:org.jetbrains.skia.Canvas#save(){}kotlin.Int at /opt/buildAgent/work/a64d3aa477d12f6b/skiko/src/commonMain/kotlin/org/jetbrains/skia/Canvas.kt:1280
#2	0x0000000102d7613c in kfun:androidx.compose.ui.scene.RenderingUIViewDelegateImpl.withSceneOffset#internal [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt:177
#3	0x0000000102d760f4 in kfun:androidx.compose.ui.scene.RenderingUIViewDelegateImpl.onRender#internal at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt:170
#4	0x0000000103f3697c in kfun:org.jetbrains.skiko.SkikoRenderDelegate#onRender(org.jetbrains.skia.Canvas;kotlin.Int;kotlin.Int;kotlin.Long){}-trampoline at /opt/buildAgent/work/a64d3aa477d12f6b/skiko/src/commonMain/kotlin/org/jetbrains/skiko/SkikoRenderDelegate.kt:6
#5	0x0000000102dbf43c in kfun:androidx.compose.ui.window.RenderingUIView.object-1.render#internal at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/RenderingUIView.uikit.kt:65
#6	0x0000000103f7188c in kfun:androidx.compose.ui.window.MetalRedrawerCallbacks#render(org.jetbrains.skia.Canvas;kotlin.Double){}-trampoline at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:114
#7	0x0000000102db4214 in <inlined-out:<anonymous>> [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:315
#8	0x0000000102db4124 in kfun:kotlin#also__at__0:0(kotlin.Function1<0:0,kotlin.Unit>){0§<kotlin.Any?>}0:0 [inlined] at /opt/buildAgent/work/b2e1db4d8d903ca4/kotlin/libraries/stdlib/src/kotlin/util/Standard.kt:98
#9	0x0000000102db4124 in <inlined-out:<anonymous>> [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:313
#10	0x0000000102db4124 in kfun:androidx.compose.ui.util#trace(kotlin.String;kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui-util/src/uikitMain/kotlin/androidx/compose/ui/util/Trace.uikit.kt:52
#11	0x0000000102db4124 in <inlined-out:<anonymous>> [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:305
#12	0x0000000102db4124 in kfun:kotlinx.cinterop#autoreleasepool(kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 [inlined] at /opt/buildAgent/work/b2e1db4d8d903ca4/kotlin/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/ObjectiveCUtils.kt:13
#13	0x0000000102db4124 in <inlined-out:<anonymous>> [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:295
#14	0x0000000102db4124 in kfun:androidx.compose.ui.util#trace(kotlin.String;kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 [inlined] at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui-util/src/uikitMain/kotlin/androidx/compose/ui/util/Trace.uikit.kt:52
#15	0x0000000102db4124 in kfun:androidx.compose.ui.window.MetalRedrawer.draw#internal at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:290
#16	0x0000000102db3108 in kfun:androidx.compose.ui.window.MetalRedrawer#drawSynchronously(){} at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/MetalRedrawer.uikit.kt:287
#17	0x0000000102dbeda4 in kfun:androidx.compose.ui.window.RenderingUIView.updateMetalLayerSize#internal at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/RenderingUIView.uikit.kt:138
#18	0x0000000102dbdc44 in kfun:androidx.compose.ui.window.RenderingUIView#objc:layoutSubviews at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/RenderingUIView.uikit.kt:116
#19	0x0000000102dc0190 in _6f72672e6a6574627261696e732e636f6d706f73652e75693a75692f6f70742f6275696c644167656e742f776f726b2f386132303736303934356430616562612f636f6d706f73652f75692f75692f7372632f75696b69744d61696e2f6b6f746c696e2f616e64726f6964782f636f6d706f73652f75692f77696e646f772f52656e646572696e675549566965772e75696b69742e6b74_knbridge70 at /opt/buildAgent/work/8a20760945d0aeba/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/RenderingUIView.uikit.kt:114

relative: JetBrains/compose-multiplatform#5062

@vickyleu
Copy link
Author

vickyleu commented Jul 4, 2024

I have contacted Tencent staff and learned that their use of Skia has not undergone secondary development, so this issue is a general problem.

Their original words are as follows:

This library is necessary as it is used by the meeting's business whiteboard.
The meeting team has not done secondary development on this library,
and the version used is m121. If you want to continue troubleshooting this issue,
please first confirm whether two different versions are integrated simultaneously
and whether there are symbol conflicts. Based on the existing information,
one possible reason is that there are two different versions of the dynamic library,
and only one is dynamically linked, but the versions of these two libraries differ,
causing a runtime crash. Another possibility is that Compose statically linked
different versions of Skia or symbol conflicts caused calls to behave
unexpectedly, resulting in a crash.

@vickyleu
Copy link
Author

vickyleu commented Jul 9, 2024

I attempted to recompile a dynamic library using m116-47d3027-1 and named it TencentSkia.framework, and also modified the runpath.

install_name_tool -id @rpath/TencentSkia.framework/TencentSkia TencentSkia.framework/TencentSkia

Modified the rpath search path of the associated library:

install_name_tool -change @rpath/Skia.framework/Skia \
	@rpath/TencentSkia.framework/TencentSkia \
	path/to/WMWhiteboardSDK.framework/WMWhiteboardSDK

This avoids crashes in Compose Skia, but the page displays nothing. By clicking on the blank page, I found that click events exist and requests can be sent. This means that Skia simply didn't render the Compose UI, although Compose is executing normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant