Hi :wave: I am trying to refactor an existing code...
# compose-ios
m
Hi 👋 I am trying to refactor an existing code into CMP, Android seems working fine but iOS is complaining with the following error:
Copy code
Showing Recent Messages
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

/Users/StudioProjects/iosApp/ld:1:1: ignoring duplicate libraries: '-ldl', '-lz'

Undefined symbols for architecture arm64:

  "_kfun:androidx.compose.runtime#androidx_compose_runtime_ProvidedValue$stableprop_getter$artificial(){}kotlin.Int", referenced from:

      _kfun:com.slack.circuit.sharedelements#ProvideAnimatedTransitionScope(com.slack.circuit.sharedelements.SharedElementTransitionScope.AnimatedScope;androidx.compose.animation.AnimatedVisibilityScope;kotlin.Function3<com.slack.circuit.sharedelements.SharedElementTransitionScope?,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} in libcircuit-root:circuit-shared-elements-cache.a[2](libcircuit-root:circuit-shared-elements-cache.a.o)

      _kfun:com.slack.circuit.foundation#CircuitCompositionLocals(com.slack.circuit.foundation.Circuit;com.slack.circuit.retained.RetainedStateRegistry?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){} in libcircuit-root:circuit-foundation-cache.a[2](libcircuit-root:circuit-foundation-cache.a.o)

      _kfun:com.slack.circuit.foundation#CircuitContent(com.slack.circuit.runtime.screen.Screen;com.slack.circuit.runtime.Navigator;androidx.compose.ui.Modifier?;com.slack.circuit.foundation.Circuit?;kotlin.Function4<com.slack.circuit.runtime.screen.Screen,androidx.compose.ui.Modifier,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Any?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){} in libcircuit-root:circuit-foundation-cache.a[2](libcircuit-root:circuit-foundation-cache.a.o)

      _kfun:com.slack.circuit.foundation.RetainedStateHolderImpl.RetainedStateProvider#internal in libcircuit-root:circuit-foundation-cache.a[2](libcircuit-root:circuit-foundation-cache.a.o)

      _kfun:com.slack.circuit.foundation.RetainedStateHolderImpl.RetainedStateHolderImpl$RetainedStateProvider$1.invoke#internal in libcircuit-root:circuit-foundation-cache.a[2](libcircuit-root:circuit-foundation-cache.a.o)

      _kfun:com.slack.circuit.foundation.SaveableStateHolderImpl.SaveableStateProvider#internal in libcircuit-root:circuit-foundation-cache.a[2](libcircuit-root:circuit-foundation-cache.a.o)

ld: symbol(s) not found for architecture arm64
Has anyone had a similar issue? This is probably the composable triggering this:
Copy code
@Composable
fun App() {
    val circuit = koinInject<Circuit>()
    val theme by koinInject<ThemePreference>().themeFlow.collectAsState(AppTheme.DARK)
    LocatifyTheme(theme) {
        CircuitCompositionLocals(circuit) {
            CircuitContent(
                screen = Screens.AllVenues,
            )
        }
    }
}
Tried to add those dependencies to the iOS dependencies block, but no luck!
Copy code
iosMain {
    dependencies {
        implementation(libs.ktor.client.ios)
        implementation(compose.runtime)
        implementation(compose.foundation)
        implementation(compose.material3)
        implementation(libs.circuit.foundation)
    }
}
Using:
Copy code
kotlin = "2.1.20"
ksp = "2.1.20-1.0.32"
circuit = "0.27.1"
koin = "4.0.4"
compose-multiplatform = "1.8.0"
z
You are running into CMP-7571, a bug in Compose Multiplatform 1.8. To use CMP 1.8, you'll need to wait for a release of Circuit that's also built with that version. As a temporary workaround, you can add
kotlin.native.cacheKind=none
to your
gradle.properties
file, which will resolve the issue for now. But make sure to remove this later once Circuit is updated, because this property disables caching for native builds, making them much slower.
🙌 2
This version should unblock you: https://github.com/slackhq/circuit/releases/tag/0.28.0 And you should remove
kotlin.native.cacheKind=none
!
a
@zsmb is it fair to say that all library authors must update their libraries to 1.8.0 in order for it to work on ios?
z
@Alex Styl Older library releases will still work on iOS, but you might need to disable caching (which means slower debug builds). There's also a chance that a library uses Compose only in ways that don't produce the issue, though we see that most libraries do seem to produce it. But overall, yes, it's better if authors update all their libraries to Compose Multiplatform 1.8.
m
@zsmb Tried Circuit 0.28.0 and it worked fine 🎉
👍 1