https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
l

lilypuchi

04/26/2022, 11:36 AM
I simply moved my
data
layer classes along with the dependencies (sqldelight) from
:shared
to a new Multiplatform module
:data
. But since then, iOS doesn’t build with the following error :
Copy code
Undefined symbols for architecture arm64:
  "_sqlite3_column_type", referenced from:
      _co_touchlab_sqliter_sqlite3_sqlite3_column_type_wrapper108 in result.o
  "_sqlite3_bind_parameter_index", referenced from:
      _co_touchlab_sqliter_sqlite3_sqlite3_bind_parameter_index_wrapper84 in result.o
...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:linkDebugFrameworkIosArm64'.
> Compilation finished with errors
shared/build.gradle.kts
looked like this before creating
:data
module.
Copy code
val commonMain by getting {
            dependencies {
                implementation("com.squareup.sqldelight:runtime:$sqldelight")
                implementation("com.squareup.sqldelight:coroutines-extensions:$sqldelight")
            }
        }

        val androidMain by getting {
            dependencies {
                implementation("com.squareup.sqldelight:android-driver:$sqldelight")
            }
        }

        val iosMain by creating {
            dependencies {
                implementation("com.squareup.sqldelight:native-driver:$sqldelight")
            }
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            ..
        }
After creating
:data
and moving these dependencies to
data/build.gradle.kts
, I just added this in
shared/build.gradle.kts
Copy code
val commonMain by getting {
            dependencies {
                implementation(project(":data"))
            }
        }
I haven’t changed anything else. Am I missing out on anything here ? 🤔
a

Anton Lakotka [JB]

04/26/2022, 1:07 PM
I guess you need to check what are the actual dependencies are passing to compiler. To do so you can run:
./gradlew linkDebugFrameworkIosArm64 --debug
and then find in the logs the konan arguments. Then you can compare what was before and after. From my side, it looks like some sqlite dependencies are missing.
👍 1
r

russhwolf

04/26/2022, 2:56 PM
You probably need a
-lsqlite3
compiler arg passed in your shared module. It get’s added automatically in the module where you have the SqlDelight gradle plugin applied, but you need to add it manually for other modules that talk to your SqlDelight code but don’t have the plugin.
👍 1
l

lilypuchi

04/27/2022, 3:39 AM
Adding
-lsqlite
worked! Thanks a lot both of you 😄
5 Views