Páginas

terça-feira, 29 de maio de 2012

Compiling SQLite as a shared library on Ubuntu

I wanted to have the most recent SQLite available for my Python applications.
Ubuntu repositories couldn't help, so, for future reference, here is what I did:

cd /tmp
wget http://www.sqlite.org/sqlite-autoconf-3071201.tar.gz
tar xvzf sqlite-autoconf-3071201.tar.gz
cd sqlite-autoconf-3071201/
# set your own options
CFLAGS="-Os -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE" ./configure --prefix=/usr
make

# quick-n-dirty way to replace the original lib
sudo mv /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6{,.orig}
sudo mv /usr/bin/sqlite3{,.orig}

chmod -x .libs/libsqlite3.so.0.8.6
sudo cp .libs/libsqlite3.so.0.8.6 /usr/lib/x86_64-linux-gnu/
sudo cp .libs/sqlite3 /usr/bin/

cd
# check that Python sees the new version
python -c 'import sqlite3; print sqlite3.sqlite_version'
# check that SQLite shell works
sqlite3

Nenhum comentário: