Sqlite under Linux


I managed to get Sqlite work with Pharo under linux (Fedora), in both 32 and 64 bit. The setup has nothing to do with LD_LIBRARY_PATH. I’ll use those example under fedora linux.
First, of course, you need to install either UDBCSqlite or Garage-Sqlite drivers
You first need to have sqlite3 libs installed on your system
$ rpm -qa | grep sqlite
=> for 64 bits version
=> for 32 bits version
Then find the path of your library
$ rpm -ql sqlite-libs.i686
/usr/lib/libsqlite3.so.0 -> this is your path in 32 bits
$ rpm -ql sqlite-libs.x86_64
/usr/lib64/libsqlite3.so.0 -> this is your path in 64 bits

Under Linux, you have to give the library path inside Pharo Image, or link the library from pharo VM folder:

1. Update library path from pharo image

Using UDBDSQLite, update to return the path of the library on your system

UDBCSQLite3Library >> library

Smalltalk os isMacOS ifTrue: [ ^ #sqlite3 ].

^ ‘sqlite3’


UDBCSQLite3Library >> library

Smalltalk os isMacOS ifTrue: [ ^ #sqlite3 ].


If you are using Garage,Update:

GASqlite3FFI >> library

^ ‘/usr/lib/libsqlite3.so.0’

2. link the library from VM folder:

ln -s /usr/lib/libsqlite3.so.0 libsqlite3 or ln -s /usr/lib64/libsqlite3.so.0 sqlite3 if the module name is sqlite3 in your library method.

Then your test should pass green.
The reason it pass under windows is because the method library return by default sqlite3, which is the dll name you put under pharo VM directory to get it work.
On linux, unless you link your library in the VM folder, the image has no clue where to find sqlite3.
Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: