Bug 129340 - ld does not search /etc/ld.so.conf.d/* files
ld does not search /etc/ld.so.conf.d/* files
Product: Fedora
Classification: Fedora
Component: binutils (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-08-06 13:36 EDT by Aaron Gaudio
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-04 15:57:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Aaron Gaudio 2004-08-06 13:36:08 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Gecko/20040510 Galeon/1.3.14

Description of problem:
According to the ld man page, if no -rpath or -rpath-link options are
given, ld will (after exhausting a few other alternatives) search the
directories listed in /etc/ld.so.conf to find shared libraries that
other shared libraries being linked depend on.

However, in my case, /etc/ld.so.conf contains an 'include' directive
to include the files in /etc/ld.so.conf.d. ld does not appear to
understand this, and thus cannot find libraries under /usr/X11R6/lib
when I have put that directory under a file in /etc/ld.so.conf.d
rather than directly in /etc/ld.so.conf.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
 Here is some sample code:

% cat > testgl.c << EOF
char glNewList();
int main() {
    return 0;

% cc -o testgl -lGl -L/usr/X11R6/lib -lX11

Actual Results:  If you don't have /usr/X11R6/lib directly in your
ld.so.conf, this will give you an error because it can't find the
libXext.so and related shared libs that libX11 depends on. 

Expected Results:  ld will read /etc/ld.so.conf, including the files
in /etc/ld.so.conf.d (if there is an "include ld.so.conf.d/*.conf"
line in ld.so.conf). If one of those files includes the /usr/X11R6/lib
directory, the sample code should link without error or warning.

Additional info:
Comment 1 Cameron Davidson 2004-08-26 08:36:29 EDT
There is another aspect to this that I just fell over:
It breaks some configure scripts.

I was building nessus 2.0.12 (gtk2 client in nessus-core) and the
configure script generated a makefile with no X11 libs explicitly defined.
That is, the linking command in the makefile contains -L
/usr/X11R6/lib,  but no -lX11.
If /usr/X11R6/lib is in /etc/ld/so.conf then ld aparrently locates and
includes the X libs through a requirement in the gtk shared libs. (I
did not know it could do this).

On the other hand, if /usr/X11R6/lib is in a file under ld.so.conf.d
then ld cannot find it, and an explicit -lX11 is required on the
linking line. An error about each missing library is issued before all
the unresolved symbols. The -L specified path is not used in this case
but I suppose that ld is meant to behave that way.

Note You need to log in before you can comment on or make changes to this bug.