FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 10-01-2008, 04:53 PM
Helmut Jarausch
 
Default "prelink" a dynamic library

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
 
Old 10-02-2008, 12:19 PM
 
Default "prelink" a dynamic library

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
 
Old 10-03-2008, 10:21 AM
Helmut Jarausch
 
Default "prelink" a dynamic library

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
 
Old 10-03-2008, 05:49 PM
"b.n."
 
Default "prelink" a dynamic library

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.
 
Old 10-03-2008, 06:24 PM
"Paul Hartman"
 
Default "prelink" a dynamic library

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
 

Thread Tools




All times are GMT. The time now is 11:22 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org