Skip to content
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

Docs on how to compile and link SQLite #74

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

Conversation

chillfox
Copy link

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

@bcardiff
Copy link
Member

bcardiff commented Dec 1, 2021

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!

@chillfox
Copy link
Author

chillfox commented Dec 3, 2021

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
Copy link
Author

chillfox commented Jan 3, 2022

@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

Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content looks good.

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

@chillfox
Copy link
Author

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
Copy link
Author

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

@straight-shoota
Copy link
Member

Maybe just go with docs?

@chillfox
Copy link
Author

Maybe just go with docs?

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

@straight-shoota
Copy link
Member

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

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

Successfully merging this pull request may close these issues.

3 participants