Re: Using a specific version of a dynamic library - how?
From: Paul Pluzhnikov (ppluzhnikov-nsp_at_charter.net)
Date: 05/08/04
- Next message: Steve Kirkendall: "Re: Regular Expressions in C"
- Previous message: Thomas Aho: "Using a specific version of a dynamic library - how?"
- In reply to: Thomas Aho: "Using a specific version of a dynamic library - how?"
- Next in thread: Thomas Aho: "Re: Using a specific version of a dynamic library - how?"
- Reply: Thomas Aho: "Re: Using a specific version of a dynamic library - how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 08 May 2004 11:17:17 -0700
my_spam@bluewin.ch (Thomas Aho) writes:
> Is there a way to link my application in a way, which makes it select
> a certain version of a dynamic library at run-time?
Yes.
> Say for example that I write an application and use qt 3.1.2. I want
> to be
[Fix your line wrapping, will you ... It's ugly]
> able to install the binary on a server from where everyone in my
> organization
> can run it. A precondition is then of course that they have the
> qt-mt.so.3.1.2
> or qt-mt.so.3.1 somewhere in their LD_LIBRARY_PATH.
> The problem is that if there is also a newer version of qt installed
> on their
> system, /usr/lib/qt-mt.so will be linked to for example
> qt-mt.so.3.2.2. When
> starting my application, it will load the 3.2.2 version of qt-mt,
> which fails.
That is not supposed to happen: if 3.2.2 is not compatible with
3.1.2, it is supposed increment its "external version".
What exactly is the failure? Are you sure it is not caused by a
bug in your app?
> What I simply would like to do is to link my application in a way
> which makes
> it "look for 3.1.2; if there is no 3.1.2, look for 3.1; if there is no
> 3.1, look for 3, ...".
That is impossible, I think.
What you can do is link it in such a way that it explicitly looks
for 3.1.2; or 3.1; or 3 (which is what it is probably doing now).
Begin by finding out what is currently recorded as the application
dependency: 'objdump -p exename | grep NEEDED | grep libqt' will
probably print:
NEEDED libqt-mt.so.3
Then read up on "external library versioning", here is one place:
http://docs.sun.com/db/doc/816-1386/6m7qcoblb?a=view
> Is it possible to do what I want?
If you want to bind your app to e.g. libqt-mt-so.3.1, you'll have
to build yourself a "custom" copy of libqt-mt.so.3.1.2. The very
last command in the build looks something like:
g++ -shared ... -o libqt-mt.so.3.1.2 -Wl,-soname,libqt-mt.so.3 ...
Change the soname part to libqt-mt.so.3.1, relink your app against
the new libqt-mt.so you just built, and presto.
Cheers,
-- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email.
- Next message: Steve Kirkendall: "Re: Regular Expressions in C"
- Previous message: Thomas Aho: "Using a specific version of a dynamic library - how?"
- In reply to: Thomas Aho: "Using a specific version of a dynamic library - how?"
- Next in thread: Thomas Aho: "Re: Using a specific version of a dynamic library - how?"
- Reply: Thomas Aho: "Re: Using a specific version of a dynamic library - how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|