public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] "prelink" a dynamic library
@ 2008-10-01 16:53 Helmut Jarausch
  2008-10-02 12:19 ` bzk0711
  2008-10-03 18:24 ` Paul Hartman
  0 siblings, 2 replies; 5+ messages in thread
From: Helmut Jarausch @ 2008-10-01 16:53 UTC (permalink / raw
  To: gentoo-user

Hi,

I want to create a shared library, say libULIB.so,
which needs additional shared libraries, e.g. libmpfr.so and
libgmp.so .

My users only use the functions provided by libULIB.so.

Is there a means to "prelink" libULIB.so, so that the libraries
libmpfr.so and libgmp.so are not needed by the user?

I.e.

instead of

g++ Example.C -lUlib -lmpfr -lgmp

it should be suffucient to say

g++ Example.C -lUlib

Given Ulib.o I've tried

g++ -shared -o libUlib.so -fpic -Wl,-soname,libUlib.so \
    -Wl,-rpath,$LIBPATH -Wl,-export-dynamic \
    Ulib.o -L $LIBPATH -lmpfr -lgmp

but I still need -lmpfr -lgmp to get an executable.

Many thanks for a hint,
Helmut.

-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] "prelink" a dynamic library
  2008-10-01 16:53 [gentoo-user] "prelink" a dynamic library Helmut Jarausch
@ 2008-10-02 12:19 ` bzk0711
  2008-10-03 10:21   ` Helmut Jarausch
  2008-10-03 18:24 ` Paul Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: bzk0711 @ 2008-10-02 12:19 UTC (permalink / raw
  To: gentoo-user

On Wed, 01 Oct 2008 18:53:04 +0200 (CEST)
Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:

> Hi,

Hello Helmut,
 
> I want to create a shared library, say libULIB.so,
> which needs additional shared libraries, e.g. libmpfr.so and
> libgmp.so .
> 
> My users only use the functions provided by libULIB.so.
> 
> Is there a means to "prelink" libULIB.so, so that the libraries
> libmpfr.so and libgmp.so are not needed by the user?

You should be able to just provide the libraries to the linker when
linking your shared object. When *running* the application, your shared
object (i.e. the loader) should transitively pull in the libs on which
yours depends. You can check those dependencies using ldd <your-lib>.

Hope this helps,
Patric



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] "prelink" a dynamic library
  2008-10-02 12:19 ` bzk0711
@ 2008-10-03 10:21   ` Helmut Jarausch
  2008-10-03 17:49     ` b.n.
  0 siblings, 1 reply; 5+ messages in thread
From: Helmut Jarausch @ 2008-10-03 10:21 UTC (permalink / raw
  To: gentoo-user; +Cc: bzk0711

On  2 Oct, bzk0711@aim.com wrote:
> On Wed, 01 Oct 2008 18:53:04 +0200 (CEST)
> Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:
> 
>> Hi,
> 
> Hello Helmut,
>  
>> I want to create a shared library, say libULIB.so,
>> which needs additional shared libraries, e.g. libmpfr.so and
>> libgmp.so .
>> 
>> My users only use the functions provided by libULIB.so.
>> 
>> Is there a means to "prelink" libULIB.so, so that the libraries
>> libmpfr.so and libgmp.so are not needed by the user?
> 
> You should be able to just provide the libraries to the linker when
> linking your shared object. When *running* the application, your shared
> object (i.e. the loader) should transitively pull in the libs on which
> yours depends. You can check those dependencies using ldd <your-lib>.
> 
> Hope this helps,
> Patric

Thanks Patric, but unfortunately that's not what I want.
In this case, these "secondary" libraries (e.g. libmpfr.so and
libgmp.so) have to be present on the target machines together
with an 'rpath' if they are in non-standard directories.

My aim was to let the linker generate a big library which
obseletes the secondary libraries.

Helmut.

-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] "prelink" a dynamic library
  2008-10-03 10:21   ` Helmut Jarausch
@ 2008-10-03 17:49     ` b.n.
  0 siblings, 0 replies; 5+ messages in thread
From: b.n. @ 2008-10-03 17:49 UTC (permalink / raw
  To: gentoo-user

Helmut Jarausch ha scritto:
> On  2 Oct, bzk0711@aim.com wrote:
>> On Wed, 01 Oct 2008 18:53:04 +0200 (CEST)
>> Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:
>>
>>> Hi,
>> Hello Helmut,
>>  
>>> I want to create a shared library, say libULIB.so,
>>> which needs additional shared libraries, e.g. libmpfr.so and
>>> libgmp.so .
>>>
>>> My users only use the functions provided by libULIB.so.
>>>
>>> Is there a means to "prelink" libULIB.so, so that the libraries
>>> libmpfr.so and libgmp.so are not needed by the user?
>> You should be able to just provide the libraries to the linker when
>> linking your shared object. When *running* the application, your shared
>> object (i.e. the loader) should transitively pull in the libs on which
>> yours depends. You can check those dependencies using ldd <your-lib>.
>>
>> Hope this helps,
>> Patric
> 
> Thanks Patric, but unfortunately that's not what I want.
> In this case, these "secondary" libraries (e.g. libmpfr.so and
> libgmp.so) have to be present on the target machines together
> with an 'rpath' if they are in non-standard directories.
> 
> My aim was to let the linker generate a big library which
> obseletes the secondary libraries.

If I understand correctly, you want them to be statically linked.

m.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] "prelink" a dynamic library
  2008-10-01 16:53 [gentoo-user] "prelink" a dynamic library Helmut Jarausch
  2008-10-02 12:19 ` bzk0711
@ 2008-10-03 18:24 ` Paul Hartman
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Hartman @ 2008-10-03 18:24 UTC (permalink / raw
  To: gentoo-user

On Wed, Oct 1, 2008 at 11:53 AM, Helmut Jarausch
<jarausch@igpm.rwth-aachen.de> wrote:
> Hi,
>
> I want to create a shared library, say libULIB.so,
> which needs additional shared libraries, e.g. libmpfr.so and
> libgmp.so .
>
> My users only use the functions provided by libULIB.so.
>
> Is there a means to "prelink" libULIB.so, so that the libraries
> libmpfr.so and libgmp.so are not needed by the user?

use the -static commandline option of gcc.

Paul



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-03 18:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-01 16:53 [gentoo-user] "prelink" a dynamic library Helmut Jarausch
2008-10-02 12:19 ` bzk0711
2008-10-03 10:21   ` Helmut Jarausch
2008-10-03 17:49     ` b.n.
2008-10-03 18:24 ` Paul Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox