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 09-06-2010, 09:24 PM
Al
 
Default Shared libraries in Gentoo

>> How does a program in Gentoo know, where to look for shared libraries?
>
> The program doesn't know. *But the runtime linker does. *And those paths are
> in /etc/ld.so.conf. *This file gets updated automatically by portage when
> needed.
>
> But... sometimes the program also knows and can link against libraries long
> after it has started up using a dlopen() call:
>
> http://linux.die.net/man/3/dlopen
>

Thank you Nikos. I did read obout this in the Linux HOWTO:

http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html#DL-LIBRARIES

But I was woundering if the /etc/ld.so.conf was only historical stuff.
O.K. is not it's up-to-date. Good to know this.

But it also writes that dlopen() is specific for Linux and Solaris.
There would be alternatives:

1.) The glib library
2.) libltdl, which is part of GNU libtool

Now I was woundering, which way would Gentoo choose or if that is not
package specific at all. Are you sure dlopen() is used as a general
approach on Gentoo?

Also I installed a few libries with Prefix Gentoo on Cygwin. On Cygwin
there is no /etc/ld.so.conf. Yet the libraries are found somehow. I
still have to find out how it works in that environment.

Al
 
Old 09-06-2010, 09:38 PM
Al
 
Default Shared libraries in Gentoo

> Also I installed a few libries with Prefix Gentoo on Cygwin. On Cygwin
> there is no /etc/ld.so.conf. Yet the libraries are found somehow. I
> still have to find out how it works in that environment.

Ah! Your manpage answers this question: "The directories /lib and
/usr/lib are searched" as last step.

Al
 
Old 09-06-2010, 10:43 PM
walt
 
Default Shared libraries in Gentoo

On 09/06/2010 11:28 AM, Al wrote:

Hello,

I looked into many ebuilds, but didn't come to a final conclusion yet.
I am rather confused.


Welcome


How does a program in Gentoo know, where to look for shared libraries?


Try running "ldconfig -p", which relates to Nikos's comment about ld.so.conf.


Is this compiled into the programes by means of rpath?


Are you coming from a BSD background? I know NetBSD uses rpath everywhere, and
they don't use the ld.so.conf mechanism at all, but I can't recall if the others
do or don't.

Some gentoo packages use rpath, others don't. Use readelf -d <file> to list the
runtime needs of <file>. For example:

#readelf -d /usrlib/evolution/2.30/libevolution-mail-settings.so.0.0.0 | grep Library
0x0000000e (SONAME) Library soname: [libevolution-mail-settings.so.0]
0x0000000f (RPATH) Library rpath: [/usr/lib/evolution/2.30:/usr/lib]
0x0000001d (RUNPATH) Library runpath: [/usr/lib/evolution/2.30:/usr/lib]

On the other hand:

$readelf -d /lib/libm.so.6 | grep Library
0x0000000e (SONAME) Library soname: [libm.so.6]


Does this rather differ on per package basis?


Apparently yes, but I get the impression that the upstream maintainers make that
decision for gentoo, whereas the NetBSD devs add the needed linker flags for every
package they use: "-Wl,-rpath,'$ORIGIN/../lib" (man 8 ld.so).

Corrections welcomed.
 
Old 09-06-2010, 10:49 PM
Nikos Chantziaras
 
Default Shared libraries in Gentoo

On 09/07/2010 12:24 AM, Al wrote:

How does a program in Gentoo know, where to look for shared libraries?


The program doesn't know. But the runtime linker does. And those paths are
in /etc/ld.so.conf. This file gets updated automatically by portage when
needed.

But... sometimes the program also knows and can link against libraries long
after it has started up using a dlopen() call:

http://linux.die.net/man/3/dlopen



Thank you Nikos. I did read obout this in the Linux HOWTO:

http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html#DL-LIBRARIES

But I was woundering if the /etc/ld.so.conf was only historical stuff.
O.K. is not it's up-to-date. Good to know this.

But it also writes that dlopen() is specific for Linux and Solaris.
There would be alternatives:

1.) The glib library
2.) libltdl, which is part of GNU libtool

Now I was woundering, which way would Gentoo choose or if that is not
package specific at all. Are you sure dlopen() is used as a general
approach on Gentoo?


Gentoo doesn't choose anything; it's up to the programs to decide how
they want to load libraries at runtime. It's like asking whether Gentoo
chooses to use Qt or Gtk to run Firefox; well, since Firefox is a Gtk
application and is making calls to Gtk functions, Gentoo doesn't have a
say about it.
 
Old 09-07-2010, 12:39 AM
Al
 
Default Shared libraries in Gentoo

>
> Are you coming from a BSD background? *I know NetBSD uses rpath everywhere,
> and
> they don't use the ld.so.conf mechanism at all, but I can't recall if the
> others
> do or don't.

No, I am comming from a Debian/Ubuntu background where it simply
worked. Now I try to port Gentoo to Cygwin and it doesn't always work.
So I have to dig a little deeper to get it working, asking myself what
makes theese working while others break.

Thank you very much for all extensive hints. Unfortunately Cygwin is
not ELF but PE/COFF so all ELF debugging tools do not help. I even
have to tweak an eclasses where it relies on scanelf.

Al
 
Old 09-07-2010, 01:00 AM
Al
 
Default Shared libraries in Gentoo

>> Now I was woundering, which way would Gentoo choose or if that is not
>> package specific at all. Are you sure dlopen() is used as a general
>> approach on Gentoo?
>
> Gentoo doesn't choose anything; it's up to the programs to decide how they
> want to load libraries at runtime. *It's like asking whether Gentoo chooses
> to use Qt or Gtk to run Firefox; well, since Firefox is a Gtk application
> and is making calls to Gtk functions, Gentoo doesn't have a say about it.
>

O.K. that is one importent point I needed to understand. So the choice
of the tool to handle dynamic linking is on the side of the programs
and can't be triggert uniformly from the ebuilds.

Hmm, ist the dlopen() call the same on all plattforms? I assume, else
you would need to adapt the sources.

How can I find that out? Sure grepping the sources.

Al
 
Old 09-07-2010, 03:47 AM
Ajai Khattri
 
Default Shared libraries in Gentoo

On Tue, 7 Sep 2010, Al wrote:


No, I am comming from a Debian/Ubuntu background where it simply
worked.


Same mechanism there too - Debian/Ubuntu also use /etc/ld.so.conf and/or
/etc/ld.so.conf.d. You dont see it because you only deal with binary
packages when updating in Debian/Ubuntu.



Now I try to port Gentoo to Cygwin and it doesn't always work.


When you say Gentoo, do you mean Portage? Remember Windows has a lot of
limitations that WILL get in your way so dont be surprised when things
break.



--
A
 
Old 09-07-2010, 09:33 AM
Al
 
Default Shared libraries in Gentoo

>
> When you say Gentoo, do you mean Portage? Remember Windows has a lot of
> limitations that WILL get in your way so dont be surprised when things
> break.

I am specially interested in Gentoo because it is not another linux
distribution, but an administration tool to build your own sources and
it's scope is wider than linux.

Al
 
Old 09-07-2010, 04:13 PM
Ajai Khattri
 
Default Shared libraries in Gentoo

On Tue, 7 Sep 2010, Al wrote:


When you say Gentoo, do you mean Portage? Remember Windows has a lot of
limitations that WILL get in your way so dont be surprised when things
break.


I am specially interested in Gentoo because it is not another linux
distribution, but an administration tool to build your own sources and
it's scope is wider than linux.


Which doesn't actually answer the question...



--
A
 
Old 09-07-2010, 04:40 PM
Alan McKinnon
 
Default Shared libraries in Gentoo

Apparently, though unproven, at 18:13 on Tuesday 07 September 2010, Ajai
Khattri did opine thusly:

> On Tue, 7 Sep 2010, Al wrote:
> >> When you say Gentoo, do you mean Portage? Remember Windows has a lot of
> >> limitations that WILL get in your way so dont be surprised when things
> >> break.
> >
> > I am specially interested in Gentoo because it is not another linux
> > distribution, but an administration tool to build your own sources and
> > it's scope is wider than linux.
>
> Which doesn't actually answer the question...

Gentoo is an idea, a community, an infrastructure. It is not code or a distro.

To build something, you do not use gentoo, you use portage.

To be accurate though, you use the EAPIs, which portage implements. And
currently, even after a lot of hard work, the EAPIs are still in large part
effectively defined as "whatever portage does".

So it really does come down to portage after all. Portage has a hard
dependency on bash. portage is intimately wrapped up in the linux way of doing
things.

So unless you are someone who likes pain and/or likes massive porting efforts,
portage (aka gentoo) has an effective scope that is pretty much linux and not
much else.

As evidence: the only non-linux port that went anywhere was on FreeBSD, now
moribund for years.

--
alan dot mckinnon at gmail dot com
 

Thread Tools




All times are GMT. The time now is 12:14 PM.

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