JetBrains / skiko

Kotlin Multiplatform bindings to Skia
Apache License 2.0
1.74k stars 108 forks source link

conflict between Skiko and Skia.framework in iOS #953

Open vickyleu opened 3 days ago

vickyleu commented 3 days ago

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 commented 2 days ago

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.