Re: [pysqlite] Using pysqlite with sqlite binary in non-standard location

Roger Binns <[email protected]> Thu, 11 Jun 2009 19:22:08 -0700
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mercado wrote:
> I currently have pysqlite installed and working on Ubuntu 8.10. 
> Presumably it is running against the sqlite binary located at
> /usr/bin/sqlite.

pysqlite does not link against the command line shell which is what
/usr/bin/sqlite is, but rather against the sqlite shared library.  You
can use the ldd command to find out how it links. For example on my 9.04
it shows this:

$ ldd /usr/lib/python2.6/lib-dynload/_sqlite3.so
	linux-vdso.so.1 =>  (0x00007fff2a5fe000)
	libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007f0f21f56000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f0f21d3a000)
	libc.so.6 => /lib/libc.so.6 (0x00007f0f219c7000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007f0f217c3000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003e06400000)

You can use LD_LIBRARY_PATH environment variable to set locations to
look first for shared libraries.

$ export LD_LIBRARY_PATH=/tmp/sqlite/lib
$ ldd /usr/lib/python2.6/lib-dynload/_sqlite3.so
	linux-vdso.so.1 =>  (0x00007fff815ff000)
	libsqlite3.so.0 => /tmp/sqlite/lib/libsqlite3.so.0 (0x00007f1f79140000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f1f78eff000)
	libc.so.6 => /lib/libc.so.6 (0x00007f1f78b8c000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007f1f78988000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003e06400000)

Note that if you build pysqlite yourself then you can use the SQLite
amalgamation which will include the SQLite source directly into pysqlite
itself and so not look for any shared libraries.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoxu8sACgkQmOOfHg372QRLZgCgx59xWi42zZ6Mdvpb0+4xLBZ5
YPYAoK97E5CX3C6SuKj0tsnv98o+qJNB
=iscy
-----END PGP SIGNATURE-----