Ld.lld: error: unable to find library -lsqlite3

Hi, I have a small project I'm building on a Mac, targeting x86_64-unknown-linux-gnu and using cargo zigbuild to build.

I added the libsql-client = '0.31.8' crate (because Turso) and now I get the following error at the very end of the build step (cargo zigbuild --release --target x86_64-unknown-linux-gnu --features vendored-openssl), while everything works fine with cargo run.

note: ld.lld: error: unable to find library -lsqlite3

I sort of understand that the linker can't find the sqlite3 library, and because it works locally, this must not be the sqlite3 that I must have on my Mac. Is this a sqlite3 for Linux? If so how would I include it in my project?

Thanks!

when cross-compiling, you need libraries for the target system. if you don't have a libsqlite3 for linux installed, try enable the bundled feature of rusqlite:

https://docs.rs/crate/rusqlite/latest/features

Thank you so much!

I ran cargo add rusqlite -F bundled, it failed again but this time the error was very clear that I needed to lower the rusqlite crate version, which I did and then it worked.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.