Squeak 5.0 – Setting up to Use SQLite3

This tells you how to set up your environment (64 bit Windows 10 Home, 64bit Ubuntu 16.04, 64bit Mac OS X Sierra) to use the 32bit version of the SQLite3 library from the 32bit version of Squeak 5.0.

You will need

  • Squeak
  • Squeak FFI
  • Squeak SQLite3 Monticello packages
  • SQLite3 library for your platform

The same image, 32bit Squeak 5.0, Update #15120, can be used on all three platforms.

Tested Versions

Operating System

  • 64bit Windows 10 Home
  • 64bit Ubuntu 16.04
  • 64bit Mac OS X Sierra

Squeak

  • 32bit Squeak 5.0, Update #15120

SQLite3 Library

  • 32bit SQLite3 library

Squeak FFI

The SQLite3-Core-ar.7.mcz Monticello package requires FFI for Squeak:

"http://wiki.squeak.org/squeak/2426"
"How to Use FFI
Last updated at 12:20 pm UTC on 28 October 2015
"

Which can be installed like this:

(Installer repository: 'http://source.squeak.org/FFI')
    install: 'FFI-Pools';
    install: 'FFI-Kernel';
    install: 'FFI-Tests';
    install: 'FFI-Examples'.

Squeak SQLite3 Monticello packages

Download the newest Monticello packages that work with 32bit Squeak 5.0 (15113/15120) on 64 bit Windows 10 Home, 64bit Ubuntu 16.04, 64bit Mac OS X Sierra:

SQLite3-Core-ar.7.mcz
SQLite3-Tests-ar.4.mcz

from

 http://smalltalkhub.com/#!/~TorstenBergmann/SQLite/

to

package-cache

.

Monticello Repository

Or add a Monticello HTTP repository

MCHttpRepository
    location: 'http://smalltalkhub.com/mc/TorstenBergmann/SQLite/main'
    user: ''
    password: ''
.

to Monticello Browser.

SQLite3 library for your platform

To install the SQLite3 library itself:

on Windows – sqlite3.dll

* For Windows - get a 32bit DLL from the website
"The SQLite3 Web Site" "http://sqlite.org/download.html".
For Squeak 5.0, Update 15120 (Squeak5.0-15120-32bit-All-in-One.zip),
put the sqlite3.dll into the
Squeak5.0-15120-32bit-All-in-One.app\Contents\Win32
directory.
For Squeak 5.0, Update 15113 (Squeak-5.0-All-in-One.zip),
put the sqlite3.dll into the 
Squeak-5.0-All-in-One.app\Contents\LinuxAndWindows
directory.

on Ubuntu – libsqlite3.so

* For Ubuntu - install the 32bit package libsqlite3-0:i386 with apt-get:
sudo apt install libsqlite3-0:i386
look inside the package to locate the libsqlite3 library:
dpkg -L libsqlite3-0:i386

create a symlink to the library in the directory
where all the other plugins are:
cd Squeak5.0-15120-32bit-All-in-One.app/Contents/Linux-i686/lib/squeak/5.0-3397
ln -s /usr/lib/i386-linux-gnu/libsqlite3.so.0 libsqlite3.so

on Mac – libsqlite3.dylib

* For Mac OS X - it comes with a 32bit libsqlite3.dylib preinstalled.
Get Xcode and compile from sources to get the latest version.

API

Have a look at

#execute:args:do:

UTF8

if you convert String arguments for the
#execute:args:do:
method with #squeakToUtf8
and String results with #utf8ToSqueak
you will be able to work with accented characters.

What about Squeak 5.1? Squeak 6.0 alpha?

The same Squeak 5.0 image works on all three platforms – Windows, Mac and Linux.

The same Squeak 4.6 image works on all three platforms – Windows, Mac and Linux. And on FreeBSD.

On Squeak 5.0/4.6 FFI just works out of the box – the same SQLite3 mcz package works on all supported platforms. I can not get the same SQLite3 mcz to work in a 32bit Squeak 5.1 and/or Squeak 6.0 alpha image on all three platforms – Windows, Mac and Linux. I’m not sure what has changed in FFI in Squeak 5.1. I can get it to work in a 32bit image on some. In a 64bit image on others. It has to do with FFI and parameter passing (integer size 4 vs 8?) and so far I don’t know how to fix it. Perhaps platform specific versions of SQLite3 mcz would help? Wanting support on all three platforms multiplies the testing effort by a factor of 3. Wanting 32bit and 64bit support on all three platforms by a factor of 6.

Squeak FFI is supported by the core Squeak development team so hopefully it will eventually work on all three platforms the same way it does in Squeak 5.0/4.6.

Until it does, Squeak 5.0/4.6 is your best bet for multiplatform SQLite3 in Squeak.

 

 

Advertisements

6 thoughts on “Squeak 5.0 – Setting up to Use SQLite3

    1. There are two sqlite packages for Ubuntu.
      The sqlite3:i386 is the one that contains the command line utility.
      The libsqlite3-0:i386 is the one with the library that is called from Squeak.
      Check with dpkg -L sqlite3:i386 to see what the package contains.
      You don’t need the 32bit sqlite command line utility
      because the 64bit version works fine when used from the shell.
      You do need the 32bit version of the library because that is what
      Squeak calls.

      Like

    1. I don’t like SQLite3-Core-ar.8.

      Here’s why.
      It acts strange in Monticello Browser when comparing changes in history.
      It has two ancestor packages instead of one.
      When you compare it against one of its ancestors SQLite3-Core-ar.7
      you get one method
      SqliteResult>>#readStringAtAddress:
      but it does not show you what has changed.
      If you compare it against the other ancestor SQLite3-Core-tbn.5
      it shows many changes.
      However.
      If you compare it against a more distant ancestor SQLite3-Core-ar.6
      you can see only a few methods have changed.

      So it adds a lot of confusion when comparing the versions and provides no useful code changes over SQLite3-Core-ar.7.

      I recommend SQLite3-Core-ar.7.
      It only has one ancestor.

      Like

    2. On Ubuntu the library needs to be renamed to
      libsqlite3.so
      and copied into the plugins folder.
      On Linux the string
      ‘sqlite3’
      from
      SqliteLibrary class>>#moduleName
      gets a
      ‘lib’
      prefix and a
      ‘.so’
      suffix.

      Like

  1. And as a bonus point,
    if you convert String arguments for the
    #execute:args:do:
    method with #squeakToUtf8
    and String results with #utf8ToSqueak
    you will be able to work with accented characters.

    Like

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