Getting following error when building iOS shared m...
# squarelibraries
f
Getting following error when building iOS shared module with molecule dependency
Copy code
e: Module "app.cash.molecule:molecule-runtime (app.cash.molecule:molecule-runtime-iosarm64)" has a reference to symbol androidx.compose.runtime/Composition.setContent|-2259719813581705387[0]. Neither the module itself nor its dependencies contain such declaration.
What am I doing wrong? I am using Kotlin 1.8.0.
Copy code
This could happen if the required dependency is missing in the project. Or if there is a dependency of "app.cash.molecule:molecule-runtime (app.cash.molecule:molecule-runtime-iosarm64)" that has a different version in the project than the version that "app.cash.molecule:molecule-runtime (app.cash.molecule:molecule-runtime-iosarm64): 0.7.0" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.

The list of "app.cash.molecule:molecule-runtime (app.cash.molecule:molecule-runtime-iosarm64): 0.7.0" dependencies that may lead to conflicts:
1. "stdlib: 1.8.0" (was initially compiled with "stdlib: 1.6.21")
2. "org.jetbrains.kotlin.native.platform.CoreFoundation: 1.8.0" (was initially compiled with "org.jetbrains.kotlin.native.platform.CoreFoundation: 1.6.21")
3. "org.jetbrains.kotlin.native.platform.darwin: 1.8.0" (was initially compiled with "org.jetbrains.kotlin.native.platform.darwin: 1.6.21")
4. "org.jetbrains.kotlin.native.platform.posix: 1.8.0" (was initially compiled with "org.jetbrains.kotlin.native.platform.posix: 1.6.21")
5. "org.jetbrains.kotlinx:atomicfu (org.jetbrains.kotlinx:atomicfu-iosarm64): 0.18.5" (was initially compiled with "org.jetbrains.kotlinx:atomicfu (org.jetbrains.kotlinx:atomicfu-iosarm64): 0.17.3")
6. "org.jetbrains.kotlinx:kotlinx-coroutines-core (org.jetbrains.kotlinx:kotlinx-coroutines-core-iosarm64): 1.6.4" (was initially compiled with "org.jetbrains.kotlinx:kotlinx-coroutines-core (org.jetbrains.kotlinx:kotlinx-coroutines-core-iosarm64): 1.6.1")
j
f
Nope, will try 🙏
Thank you, that definitely helped. But now I see this error (not sure if it's related)
Copy code
> Task :sharedMobile:linkDebugFrameworkIosArm64 FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture arm64:
  "_kfun:(...path to @Composable function...)", referenced from:

  ... more "_objc2kotlin_kfun" stuff

ld: symbol(s) not found for architecture arm64
But at least I have different error now after an hour of debugging 😄
s
are your composable functions public?
f
yes
s
what happens if you make them internal?
k
If its the above, its a bug in the compose compiler in (I think?) IOS source sets
f
huh, that works 🤔 So the workaround is to expose only the
StateFlow
and keep the
@Comcposable
functions internal I guess... 😕
Thank you Saket. You saved me a few hours of debugging 😌
k
We currently just have an abstract class that declares our molecule stuff as internal. Will move to an interface with a public function when thats resolved
p
For more information on the Composable internal issue. Notice the problem is only in the last module that builds the iOS target. You can have libraries that expose them as public. https://github.com/JetBrains/compose-jb/issues/2346
282 Views