[fpc-pascal] linux: should we hard-code versioned or unversioned shared libraries in our apps?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Aug 15 13:27:13 CEST 2012

Graeme Geldenhuys wrote:
> Hi,
> This issue has come up before in a fcl-db discussion regarding the
> Firebird Database, where the libfbclient.so was missing from many
> Linux distros (eg: Ubuntu 10.04), but a libfbclient.so.2.0 was
> available instead. FCL-DB only checks for the unversioned shared
> libraries, thus your application will probably not run out of the box.
> I've stumbled across this problem again today with OpenSUSE 12.1 and
> Synapse where I send emails from inside my applications via a secure
> SMTP connection. The Synapse library is looking for libssl.so, but by
> default OpenSUSE only has libssl.so.1.0.0.
> In both these cases, I manually created unversioned symlinks to those
> libraries, and that got my applications working again. This is not
> ideal, but I don't know how else to handle this.

Quite a long way from ideal, since it implies that an administrator has 
to be involved even if the program is only sitting in an unprivileged 
user's home directory (or is a symlink in ~ good enough?).

I'm tempted to say that this is a distro issue, and that if an upstream 
project (FireBird, OpenSSL, PostgreSQL) normally publishes an 
unversioned library that a distro is at fault if it "decorates" it with 
an appended version number without providing a symlink chain.

I'd suggest that the best solution would be for FPC policy to mandate 
that all shared library (.so etc.) usage in the RTL/FCL/LCL should be 
capable of taking a library name parameter, and for application code to 
allow this name to be specified in a .ini file. I think this would be 
safer than having the app try to deduce the location of the appropriate 
file, since sooner or later there will be a case where it sees multiple 
versions and selects the wrong one, or assumes that e.g. /usr/local/opt 
is permanently available when in fact it's a short-term NFS mount.

And doing it that way means that the user would be aware of the problem, 
and if enough users are aware of the problem it might trickle through to 
the awareness of the distreaux maintainers.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list