crystal-sqlite3 icon indicating copy to clipboard operation
crystal-sqlite3 copied to clipboard

Docs on how to compile and link SQLite

Open chillfox opened this issue 3 years ago • 8 comments
trafficstars

This should cover the basics of how to use a newer version of SQLite on Ubuntu.

I think it could be improved by covering the following, but I do think this is a decent start.

  • Static build on Alpine
  • Clang
  • Mac

chillfox avatar Nov 28 '21 08:11 chillfox

For the record, this is related to https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384

@chillfox could you add a paragraph describing in what situations someone would need/want to compile sqlite from source. I'm thinking in case your distro is out of date or you want to use development version of sqlite3. Right? Somehow I think this was also about compiling sqlite3 for static linking, but it seems it's not 🙃

Other than that I think this is good to go. Thanks!

bcardiff avatar Dec 01 '21 13:12 bcardiff

Yeah, the main reasons people usually want to compile SQLite is to get some feature from a new release or development. The other one is enabling some compile time feature that's not commonly enabled.

It would definitely be good to cover compiling for static linking as that will likely be a common use case. I will see if I get time to add that on the weekend.

chillfox avatar Dec 03 '21 01:12 chillfox

@bcardiff I had a bit of a look at how to compile SQLite for static linking and unfortunately, it requires deeper knowledge of c and the build tools than I currently have.

As far as I can tell it is something along these lines, but I am still missing something.

clang -c -Wall -o libsqlite3.o -I sqlite3.h sqlite3.c
llvm-ar rcs libsqlite3.a libsqlite3.o
crystal build --release --static --link-flags -Llibsqlite3.a app.cr

chillfox avatar Jan 03 '22 07:01 chillfox

I'm wondering if the file should be placed in a doc/ folder for a tidy root directory.

@straight-shoota sure, why not. I will move it.

chillfox avatar Feb 22 '22 23:02 chillfox

@straight-shoota doc is in .gitignore, so is that used for autogenerated stuff? maybe "guides", "tutorials" or go for the full word "documents"?

chillfox avatar Feb 23 '22 00:02 chillfox

Maybe just go with docs?

straight-shoota avatar Feb 23 '22 09:02 straight-shoota

Maybe just go with docs?

that's where crystal docs puts auto-generated API docs.

chillfox avatar Feb 23 '22 23:02 chillfox

Ah, right. I believe that should be in .gitignore then. And doc should not be.

straight-shoota avatar Feb 24 '22 09:02 straight-shoota