Skip to content

Add a note about the -lsqlite3 linker flag #5828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

guilhermemagro
Copy link

@guilhermemagro guilhermemagro commented Jul 1, 2025

Add a note about the -lsqlite3 linker flag on multiplatform_sqlite/index.md.


  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

@JakeWharton
Copy link
Collaborator

I don't think we should be linking to someone else's documentation about our project. We should just have the documentation required.

@guilhermemagro
Copy link
Author

I don't think we should be linking to someone else's documentation about our project. We should just have the documentation required.

It makes sense. And what do you think about just adding some little text explaining the need of adding this linker flag?

@guilhermemagro guilhermemagro changed the title Add a reference to the JetBrains documentation about the -lsqlite3 linker flag Add a note about the -lsqlite3 linker flag Jul 11, 2025
@guilhermemagro
Copy link
Author

I removed the external documentation and changed the note, but if you don't think we need this, I can close the PR without any problems. 😄

@eygraber
Copy link
Contributor

Maybe related - #5782

@kpgalligan
Copy link
Collaborator

I think a more complete section in the docs would be useful. This topic comes up regularly, and there's a lot of confusion around it.

In summary, if you're using the iOS system-provided sqlite library, you're going to have -lsqlite3 somewhere. It is necessary. If you're bundling your own sqlite binary, as in #5782, or possibly using something like SQLCipher, you absolutely do not want -lsqlite3 to be there.

The SqlDelight plugin includes it by default. If you're building a dynamic framework with Kotlin/KMP, which I believe is now the default, then -lsqlite3 carries over (IIRC). You don't need to set it in Xcode. That is why some tutorials say you should use a dynamic framework, without really explaining the why. If you're building a static framework, you need to add -lsqlite3 in Xcode.

I'm on the fence about trying to detect if you're bringing your own sqlite. I can see how that might help, but I also lean more towards doing this kind of stuff explicitly.

The tricky thing I've found with KMP is that the devs setting up KMP tend to be Android devs, and on average don't know much about Xcode tooling or linking. So some concise "Xcode tooling for Kotlin devs" doc either exists or is long overdue to be published (not necessarily here), but I digress.

TL;DR it would probably be useful to have a more detailed section on this explaining it. I'd take a stab at expanding this one directly, but I'm already super behind for today, so for sure not today :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants