[fpc-pascal] how to install sqlite server side library on CentOS

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 6 23:20:52 CET 2013

On 06 Dec 2013, at 18:45, Dennis Poon wrote:

> My server program written in fpc uses sqlite3 and
> in ubuntu, I just need to
> apt-get install libsqlite3-dev
> but in centos, the libsqlite3-dev does not exist and the client lib after
>   yum install sqlite
> was not enough.
> The server program still complained:  libsqlite3.so
> is missing.

The default behaviour of almost all FPC database units is buggy in the sense that they look for *.so instead of for *.so.0, *.so.1 or similar files. The *.so file indeed only exists if you install the development addendum of a package, and it's just a symlink to the latest supported version (which is a *.so.0, *.so.1 or similar file). The only purpose of such a symlink is that in case you link to a library at compile time, the program will be linked against this latest installed version (under the assumption that it was also compiled using the .h files installed on the system, which belong to this same latest installed version). They should definitely never be used for dynamic loading, because
a) they generally do not (and should not) exist on user systems
b) they could point to any version, and the unit loading it may not support that version

In case of FPC, they actually shouldn't be used in case of compile-time linking either because of point b) above, and we should again explicitly link to specific versions.

Anyway, you can work around the specific problem you are having by telling the sqlite unit to use the specifically supported version by calling InitialiseSQLite('libsqlite.so.0'). It will work on both Ubuntu and CentOS and any other Linux distribution, and no one will have to install any -dev packages.


More information about the fpc-pascal mailing list