[fpc-pascal] linux: should we hard-code versioned or unversioned
shared libraries in our apps?
jonas.maebe at elis.ugent.be
Wed Aug 15 13:49:18 CEST 2012
On 15 Aug 2012, at 13:32, Graeme Geldenhuys wrote:
> On 15 August 2012 12:10, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>> The official way to get the unversioned symbolic links is to install the -dev or
>> -devel package for that library. Of course, you're not supposed to require
>> end-users to do that.
> Yes, I know that bit, but even as a developer, if I don't do actual
> Firebird or OpenSSL development (I don't work on those project, I
> simply use there libraries), I don't need to install those libraries.
The dev/devel packages are not for people working on those libraries, they are for building programs that use those libraries. It's developers that do work on those packages themselves that don't necessarily need those packages, since they can just use their own source code.
> That is why my Ubuntu and OpenSUSE system didn't have the -devel
> packages for them installed. FCL-db and Synapse dynamically load those
> libraries on my development machines, so no -devel package
You said that you manually created the symbolic link. I simply explained that you should never do that, and instead install the development packages because they will do that (correctly) for you. Whether or not it is desirable for the FCL/Synapse units to require an unversioned symlink to be present is a separate issue.
>> ... that the linker will hardcode in your application. The reasoning is that your
>> application was written and tested against that version of the library, so letting
>> it use arbitrary other versions is not a good idea.
> In a way I understand the reasoning for the unversioned symlink, I
> just don't know how best to handle it in my apps. I also don't know
> the rules as to which version the unversioned symlib will normally
> point to.
It will point to the library of the version corresponding to the dev/devel package that has been installed.
> I know my apps work with Firebird 2.1 and Firebird 2.5, so
> should I then change fcl-db to look for libfbclient.so.2 or
> libfbclient.so.2.0 - instead of the unversioned default.
libfbclient.so.2.0 means Firebird 2.0.x. libfbclient.so.2 means Firebird 2.x. If you only support 2.1 and 2.5, you should link against libfbclient.so.2 and then call a function to get the actual version. If the library does not contain such a function, then there is simply no way to dynamically load that library and use it in a safe way in your scenario.
More information about the fpc-pascal