[fpc-devel] link search order
Vittorio Giovara
vittorio.giovara at gmail.com
Fri Feb 22 16:33:24 CET 2013
Hi,
yes I was talking about linux. I didn't include much information because I
didn't want to confuse people with details.
In this branch of Hedgewars
https://code.google.com/p/hedgewars/source/list?name=physfslayer we are
using physfs library version 2.1.0.
However many people out there have version 2.0.3 installed and (of course)
it doesn't contain many of the APIs present in 2.1.0.
So when libphysfs is not found (or an old one is detected) we provide a
copy of the right physfs and have CMake (our build system) compile and
install it. However even if I hardcode the right path of the right library
of the right version, the installed system library takes precedence, and
thus if another version of physfs is installed, hedgewars doesn't link any
more.
I would refrain from using a different library name; looking at the
generated link.res file it seems that the first lib search path is /urs/lib
and /lib and the custom one (where the right libphysfs resides) is found
only later on. Is there a way to prevent this? I tried to play with the -Xd
flag but the result didn't change.
Any help is appreciated.
Vittorio
On Fri, Feb 22, 2013 at 3:35 PM, Tomas Hajny <XHajT03 at hajny.biz> wrote:
> On Fri, February 22, 2013 10:59, Vittorio Giovara wrote:
>
>
> Hi,
>
> > I'm using fpc and trying to link it with a library, let's call it libfoo
> > version 2.
> >
> > The problem I'm facing is that many people have libfoo 1.0 installed and
> > that when linking, fpc takes libfoo 1.0 instead of the new libfoo 2.0. Of
> > course this causes a link failure as I need many libfoo version 2
> > functions.
> >
> > I set the right library search path but the system search path gets
> always
> > picked first (confirmed by looking at link.res).
> > Is there a way to force the order of search path (possibly without
> > modifying fpc.cfg or playing with linker flags)?
>
> You don't provide much information about your situation, but I assume that
> you talk about Linux here. If you need version 2, you may need to link
> explicitly to libfoo.2.so rather just libfoo.so. If you link to libfoo.so
> and this is expected to be a symbolic link to the latest installed
> version, you may also want to check why people having both libfoo 1.0 and
> libfoo 2.0 installed do not have the symbolic link pointing to the later
> version. One such reason may be not having the development version of the
> respective library installed (at least this may be the case on some Linux
> distributions as far as I know).
>
> Tomas
>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130222/26fc45e3/attachment.html>
More information about the fpc-devel
mailing list