Hello, is it possible to have `.dSYM` for static f...
# multiplatform
s
Hello, is it possible to have
.dSYM
for static frameworks? I am asking because when ios app crashes with kotlin native library, stack trace does not have anything useful. I have this from the symbolication documentation, but this only works with dynamic frameworks
Copy code
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
        binaries.all {
            freeCompilerArgs += "-Xadd-light-debug=enable"
        }
    }
I am using sqldelight library with sqlcipher, and if library is static i do not need to link
lsqlcipher
manually, otherwise if library is dynamic i need to link with either
lsqlite3
or
lsqlcipher
, but somehow it does not work and compiler complains that it cannot find
lsqlcipher
. I have added sqlcipher as cocoapod
Copy code
cocoapods {
        this.ios.deploymentTarget = "13.0"
        // Configure fields required by CocoaPods.
        summary = "Secoris core"
        homepage = "<https://github.com/JetBrains/kotlin>"

        // You can change the name of the produced framework.
        // By default, it is the name of the Gradle project.
        frameworkName = binaryBaseName

        pod("SQLCipher", "~> 4.4")
    }
linking is done like this
Copy code
targets
       .flatMap { it.compilations }
        .filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation>()
        .forEach { compilationUnit ->
            compilationUnit.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlcipher")
       }
but this gives following error
ld: library not found for -lsqlcipher
. So in conclusion i am able to have encrypted database with sqlcipher if i use static library, with no linking needed, but then there is no
.dSYM
for crash stack traces, or i can have
.dSYM
with dynamic framework, but then sqldelight links to
lsqlite3
and there is no encryption.
👀 1
m
If you don't mind me asking, how did you make your framework static? I'm having the same linking issue with SQLCipher but I couldn't solve it.
@Simonas Brazauskas could you give me a hint?
s
Copy code
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
    binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework> {
        isStatic = true
    }
}
@matej
👍 1
m
@Simonas Brazauskas thank you, I tried that, but unfortunately I keep getting
syntax error in "PRAGMA key = ?;"
. Did you encounter anything like this?
s
sqliter-driver version must be atleast 1.0.3 add this to ios dependencies
Copy code
implementation("co.touchlab:sqliter-driver:1.0.3") {
                    version {
                        strictly("1.0.3")
                    }
                }
Copy code
com.squareup.sqldelight:native-driver:1.5.0
depends on sqliter which has a bug
👍 1
m
@Simonas Brazauskas thanks again, I will give it a shot!
@Simonas Brazauskas it works now, thank you very much
co.touchlab:sqliter-driver:1.0.3
was the missing piece!
Let's see if I can repay the favor 🙂
Have you tried to change your linker settings in Xcode? One issue I had was that other libraries (Firebase) were linking the default sqlite3 before SQLCipher
I solved it by adding
-framework "SQLCipher"
to the project level linker flags, then for my main target's linker flags, I added
$(inherited)
and removed
-framework "SQLCipher"
, because the inheritance will already add it in first place.
In the Xcode UI,
-framework "SQLCipher"
should be added as two separate lines,
-framework
and then
"SQLCipher"
s
thanks, i will try it out 😉