Sqlite under Linux

Hi

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
sqlite-3.20.1-1.fc26.x86_64
sqlite-libs-3.20.1-1.fc26.x86_64
=> for 64 bits version
sqlite-3.20.1-1.fc26.i686
sqlite-libs-3.20.1-1.fc26.i686
=> 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
/usr/lib/libsqlite3.so.0.8.6
/usr/share/doc/sqlite-libs
/usr/share/doc/sqlite-libs/README.md
gnome@rdv:~
$ rpm -ql sqlite-libs.x86_64
/usr/lib64/libsqlite3.so.0 -> this is your path in 64 bits
/usr/lib64/libsqlite3.so.0.8.6
/usr/share/doc/sqlite-libs
/usr/share/doc/sqlite-libs/README.md

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’

to

UDBCSQLite3Library >> library

Smalltalk os isMacOS ifTrue: [ ^ #sqlite3 ].

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

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.
Renaud
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: