I’ve been developing on my Mac, which has SQLite version 3.32.3 2020-06-18 14:16:19 installed. Using the crystal-sqlite3 shard has worked wonderfully.
Now, I’m trying to move build and use my program on my Ubuntu 20.04 server. It doesn’t even have sqlite3 installed. Yet, when I crystal build --release --static it still seems to work? Pulled in from the shard somehow? I’m not sure.
Anyways, what doesn’t work is the sqlite3 uuid extension:
I hop onto my Ubuntu machine to try and build as you suggested. (First as is, then just into the container to try it manually) same results either way.
Hmm, I don’t know what or why - but something isn’t happy.
Update:
So I tried the above again locally, in macOS and it did manage to build.
However, when I transferred the binary back to my Ubuntu server, it started up fine until I tried to use something that called the uuid function again and get the same:
unknown function: uuid() (SQLite3::Exception)
So… back to start. How do I enable this sqlite extension? Was sqlite-dev sqlite-static supposed to include it?
This seems more like an SQLite question than a Crystal question. UUID seems to be an extension. You probably need to install the extension separately, it doesn’t seem to be provided in the system packages. Instructions: GitHub - benwebber/sqlite3-uuid: SQLite extension for generating UUIDs
The extension is probably installed on your Mac (either it’s included by default or you have installed it before, IDK).
(Disclaimer: I’m not familiar with SQLite, so this is just a hunch)
@straight-shoota thanks, and I think you are right. In fact, this is more a me problem. Crystal is my first time really using a compiled language, and I’m not really sure what I’m doing
So you think, if I manage to compile/build Sqlite3 with extensions in Linux, then when I link it… it should just work? It’s all magic to me.
Here are my notes from the last time I needed a SQLite feature that hadn’t landed in a release yet. I don’t know what you need to do to enable modules, but hopefully this will be helpfull in getting started.
On Ubuntu you will need build-essential installed at a minimum.
wget https://sqlite.org/snapshot/sqlite-snapshot-202010201440.tar.gz
tar xvfz sqlite-snapshot-202010201440.tar.gz
cd sqlite-snapshot-202010201440
./configure
make