I am just trying to get an older multiplatform pro...
# touchlab-tools
m
I am just trying to get an older multiplatform project working again (Android, iOS, Desktop). On Android and Desktop it works perfectly already but when I build for the iOS X86 simulator (I don’t have a real iOS device) I get lots of error messages like this:
Copy code
ld: Undefined symbols:
  _sqlite3_bind_blob, referenced from:
      _co_touchlab_sqliter_sqlite3_sqlite3_bind_blob_wrapper69 in composeApp[4](libco.touchlab:sqliter-driver-cinterop-sqlite3-cache.a.o)
  _sqlite3_bind_double, referenced from:
      _co_touchlab_sqliter_sqlite3_sqlite3_bind_double_wrapper71 in composeApp[4](libco.touchlab:sqliter-driver-cinterop-sqlite3-cache.a.o)
  _sqlite3_bind_int64, referenced from:
      _co_touchlab_sqliter_sqlite3_sqlite3_bind_int64_wrapper73 in composeApp[4](libco.touchlab:sqliter-driver-cinterop-sqlite3-cache.a.o)
  _sqlite3_bind_null, referenced from:
      _co_touchlab_sqliter_sqlite3_sqlite3_bind_null_wrapper74 in composeApp[4](libco.touchlab:sqliter-driver-cinterop-sqlite3-cache.a.o)
...
Does anyone know what might be going wrong here? I am not using any of the touchlab tools directly. These dependencies seem to be pulled in by SQLDelight for example. I do this on an X86 Mac in case it should matter.
d
You’ll need to link to the sqlite3 library, which is not linked to automatically for some reason under some circumstances. Here’s what we have in our `build.gradle.kts`:
Copy code
kotlin {
    […]

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.all {
            linkerOpts.add("-lsqlite3")
        }
    }
}
m
I added this
Copy code
listOf(
    iosX64(),
    iosArm64(),
    iosSimulatorArm64()
).forEach { iosTarget ->
    iosTarget.binaries.framework {
        baseName = "ComposeApp"
        isStatic = true
    }
    iosTarget.binaries.all {
        linkerOpts.add("-lsqlite3")
    }
}
to the already existing
forEach
in my build.gradle.kts file but it does not make any difference.
d
🤔 All I can say is that judging by the error message, the sqlite3 lib is not linked to the binary that is being linked when the error message is logged. You might have to figure out what binary that is that is being linked at that point, and how to add linker flags for it.
m
👍 1