Tuesday, April 12

sqlite3 ships without readline support

Which may or may not make sense, but I was somewhat annoyed to discover that the more recent SQLite shells ship without readline support. The standard binary build excluded readline support because some Linux distributions (namely Suse) do not include readline support (checkin here). What does this mean ? (someone else started the rant before I did).

Well, for one, you can't type in a SQL statement, curse to yourself because you missed out on a key piece of the syntax, hit the up arrow key, edit your previous command and fire it away. Instead, an up arrow key produces some sad ASCII. So, onto the source, Luke.

Download the source. Spend 1030 minutes futzing around with the configure options. Build a shared library version in a few minutes, but (obviously) this is a bit slower and for something as small as SQLite, I really prefer the static build route. Hmm, so how do I go about making a static build ? Get really really irritated because there isn't a lot of documentation on the build options and their interactions (and also because I seem to be wearing my dunce hat today).

./configure --disable-shared
(I'm lying. What I really typed in was ./configure --enable-static --enable-releasemode --disable-shared. Told you I was feeling stoopid today. You really don't need all that. I'm not even sure if it makes sense to mix all those)

Hold breath. Wait till the shell compiles and produces an executable. Run said executable. It works. Readline support enabled. Perform small wardance of victory. Replace my current, crippled SQLite shell with the much friendlier readline enabled version. Continue work.

There. That wasn't so hard, was it ? If you build SQLite locally and your system has readline support, the shell will automagically build with readline support too. But, making a static build, ie: the same precompiled binary available here instead of a shared executable requires a bit more work. A quick Google didn't reveal anyone else who had written about this particular problem (and it's solution) so I'm blogging it.


<< Home