I'm trying to build a release version of my compos...
# compose-ios
r
I'm trying to build a release version of my compose-ios app by going to Product->Archive on XCode but I'm getting the error below. I suspect it's got something to do with linking sqlite from SQLDelight. Debug builds are working fine.
t
We have the same issue, debug builds are working but release builds are failing with exit code 138.
Copy code
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 138.
output:
ld: warning: ignoring duplicate libraries: '-ldl', '-lobjc'

> Task :iosFramework:linkReleaseFrameworkIosArm64 FAILED
d
To give context to Tjerk's message (he's my colleague), linking release versions of our compose multiplatform module for iOS fails with that error as soon as we include either the Material3 (
compose.material3
) or the Resources (
compose.components.resources
) libraries.
We haven't found a workaround yet. Interestingly we also include sqlite using
linkerOpts("-lsqlite3")
, I'm going to try and see if that's what's causing our issue.
r
In my case, the build fails altogether if I try to remove the sqlite linker flag.
d
Are you using a static or dynamic framework (i.e.
isStatic = true
)?
r
No I'm not using a static framework
d
Neither are we
r
tbh, this is my first time trying to create an archive from my project so I have no idea what might be causing it in my case.
d
We're also very confused. As far as I can tell exit code 138 indicates a memory issue in the linker.
We've been using Kotlin Multiplatform as a framework successfully in our app for quite a while now (including SQLDelight). Also for release builds. Only when we tried adding Compose Multiplatform last week we've started seeing this error. For now we've had to revert using Compose for iOS because it's not releaseable.
t
This is probably https://youtrack.jetbrains.com/issue/KT-70202/Xcode-16-Linker-fails-with-SIGBUS-compiling-XCTest-based-tests. I ran into this issue as well, probably a recent Xcode update. The workaround in the comments is working great.
d
@Thomas You're a lifesaver! Adding
-ld_classic
does indeed fix it for now. This means we can go ahead with compose for iOS in our app. 🙂
t
@Thomas bedankt!
🇳🇱 1
r
@Thomas Thanks man, this works, but why does it work, what does that linker flag do.
t
@Rafs xcode update introduced new linker, which is broken with kotlin native. The flag switches back to the old version. Will have to wait for the Kotlin issue to be fixed, see mentioned issue.
✅ 1