https://kotlinlang.org logo
Title
m

Michael Paus

02/02/2023, 1:38 PM
I get a strange error in iOS with Kotlin 1.8.0.
> Task :shared:linkPodDebugFrameworkIosX64 FAILED
e: There are still 2 unbound symbols after generation of IR module <shared>:
Unbound public symbol IrConstructorPublicSymbolImpl: cafe.adriel.bonsai.core/BonsaiStyle.<init>|2287630319973089285[0]
Unbound public symbol IrSimpleFunctionPublicSymbolImpl: cafe.adriel.bonsai.core/BonsaiStyle.copy|-7573618836952580526[0]
More details can be found here: https://github.com/adrielcafe/bonsai/issues/11 Does anybody have an idea how to fix that or is this indeed a compiler/linker error?
p

Pablichjenkov

02/02/2023, 1:42 PM
Just with Kotlin 1.8.0? Previous versions work? Check that every function marked as Composable is internal. Is a current limitation in the iOS target.
m

Michael Paus

02/02/2023, 2:19 PM
1. No, I just haven’t tested older Kotlin verisons. 2. 2. I’ll have a look at your advice.
Hmmm, just checked with an other project of mine. Not a single composable function is marked as internal but the whole project works like a charm on iOS. Were did you hear about this limitation?
p

Pablichjenkov

02/02/2023, 3:07 PM
Here is the issue I am referring to https://github.com/JetBrains/compose-jb/issues/2346 Now I believe, that, perhaps if you enclose the Composable in a class might work. Also, what sourceset are you using uiKitMain() or iOS()?
a

ayodele

02/02/2023, 3:50 PM
I had this error once not on 1.8.0 but earlier I can't remember vividly, have you done a total clean and rebuild??
m

Michael Paus

02/02/2023, 8:37 PM
I am not using the composable functions inside a class. The project structure is derived from this example: https://github.com/JetBrains/compose-jb/tree/master/experimental/examples/falling-balls-mpp
@ayodele I’ll give that I try tomorrow.
p

Pablichjenkov

02/02/2023, 8:56 PM
Notice how the Composables or anything that exposes the Composable symbol is either internal or private. Including Modifiers. This is done for iOS to work. Notice In shared/iosMain the bindings exposed to swift/objc are UIViewControllers not Composable. As far as I am aware it is an existing issue.
m

Michael Paus

02/03/2023, 12:21 PM
I just verified that this problem is indeed related to this issue #2346 The workaround is to make every composable function internal. But that is a bit of a pain for the above code because it also uses composable lambdas as members in data structures and so all of these have to be made internal too and all functions which expose such data. So for me this can only be a temporary workaround.