lilypuchi

    lilypuchi

    5 months ago
    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 :
    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.
    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
    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]

    4 months ago
    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.
    russhwolf

    russhwolf

    4 months ago
    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.
    lilypuchi

    lilypuchi

    4 months ago
    Adding
    -lsqlite
    worked! Thanks a lot both of you 😄