Professional Web Applications Themes

ld.so.conf and its role in the linking process - Linux Setup, Configuration & Administration

I origionally posted this mesage in what I now realise is the wrong newsgroup. I'm sorry if you have therefore read this mesage twice. (If I am still in the wrong place could you please shove me in the required direction!). I want to link a compiled file, foo.o that requires a library Xmu. When I compile I use: cc -o foo foo.o -lXmu Which gives me the error: /usr/bin/ld: cannot find -lXmu I can solve this problem by compiling with the command cc -o foo foo.o -L/usr/X11R6/lib -lXmu My problem is: I have a line in the file /etc/ld.so.conf ...

  1. #1

    Default ld.so.conf and its role in the linking process

    I origionally posted this mesage in what I now realise is the wrong
    newsgroup. I'm sorry if you have therefore read this mesage twice. (If I
    am still in the wrong place could you please shove me in the required
    direction!).

    I want to link a compiled file, foo.o that requires a library Xmu. When I
    compile I use:
    cc -o foo foo.o -lXmu
    Which gives me the error:
    /usr/bin/ld: cannot find -lXmu

    I can solve this problem by compiling with the command
    cc -o foo foo.o -L/usr/X11R6/lib -lXmu

    My problem is: I have a line in the file /etc/ld.so.conf that reads
    /usr/X11R6/lib
    so as I understand it, I shouldn't need `-L/usr/X11R6/lib'.
    Incase this understanding was incorrect I ran ldconfig, but that didn't
    help. :(

    Incidentally, when I run
    ldconfig -p | grep "Xmu"
    I get
    libXmuu.so.1 (libc6) => /usr/X11R6/lib/libXmuu.so.1
    libXmuu.so (libc6) => /usr/X11R6/lib/libXmuu.so
    libXmu.so.6 (libc6) => /usr/X11R6/lib/libXmu.so.6
    libXmu.so (libc6) => /usr/X11R6/lib/libXmu.so

    According to all of the google searches that I've done my /etc/ld.so.conf
    file should do the trick.
    I have read the relevant parts of
    [url]http://www.tldp.org/HOWTO/Program-Library-HOWTO/[/url]
    and if I have understood that correctly my setup should work fine!

    Could someone please explain what is happening, and why I need `-L'.

    Thankyou
    Andy.


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    [url]http://www.newsfeeds.com[/url] - The #1 Newsgroup Service in the World!
    -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
    Andrew Jones Guest

  2. #2

    Default Re: ld.so.conf and its role in the linking process

    On Wed, 02 Jul 2003 19:04:41 +0100, Andrew Jones wrote:
    > From looking at these man pages it would appear that ld reads ld.so.conf.
    > From man ld:
    > The linker uses the following search paths to locate required
    > shared libraries.
    > ...
    > 8. For a native linker on an ELF system, if the file
    > /etc/ld.so.conf exists, the list of directories found in that
    > file.
    Linux man pages are not always authoritative or correct. It appears that
    you have found one of those inconsistencies. As an example:

    The man page for su indicates that a user executing 'su' should have the
    new UID inherit the user's environment, but:

    [duhring]$ su
    Password:
    [duhring]#

    Note the shell prompt symbol. OHOH, with Solaris:

    [duhring]$ su
    Password:
    # bash # root's shell is /sbin/sh
    [duhring]$

    > And ld.so reads ld.so.cache.
    > From man ld.so:
    > The necessary shared libraries needed by the program are searched for
    > in the following order
    > ...
    > o From the cache file /etc/ld.so.cache which contains a compiled
    > list of candidate libraries previously found in the augmented
    > library path.
    >
    > As shown by ldconfig -p ld.so.cache has the correct link as does
    > ld.so.conf. So why do I still need the `-L'?
    Just do it. Add the -R argument too, and you don't need /etc/ld.so.conf.

    Dave Uhring Guest

  3. #3

    Default Re: ld.so.conf and its role in the linking process

    In article <pan.2003.07.02.17.31.19.320806bath.ac.uk>, Andrew Jones wrote:
    [-]
    ld.so.conf is not known to or used by ld at all but the dynamic linker
    ld.so aka ld-linux.so.x.y.z.
    [-]
    > Could someone please explain what is happening, and why I need `-L'.
    [-]
    info ld.

    Ta',
    Juergen

    --
    \ Real name : Juergen Heinzl \ no flames /
    \ EMail Private : [email]juergenmanannan.org[/email] \ send money instead /
    Juergen Heinzl Guest

  4. #4

    Default Re: ld.so.conf and its role in the linking process

    Andrew Jones wrote:
    > My problem is: I have a line in the file /etc/ld.so.conf that reads
    > /usr/X11R6/lib
    .... thinking of the rwong linker. ld is the programming part of
    the equation, the other for the runtime equation
    ..
    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
    Michael J. Tobler: motorcyclist, surfer, # Black holes result
    skydiver, and author: "Inside Linux", # when God divides the
    "C++ HowTo", "C++ Unleashed" # universe by zero

    mjt Guest

Similar Threads

  1. Replies: 0
    Last Post: October 18th, 09:18 PM
  2. Replies: 6
    Last Post: May 17th, 07:08 PM
  3. Draft process overriding root relative linking
    By Dale Jr Fan in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: July 5th, 10:03 PM
  4. Replies: 1
    Last Post: February 3rd, 09:30 AM
  5. process called from inetd.conf is still living
    By Hynek Los in forum Linux / Unix Administration
    Replies: 2
    Last Post: October 7th, 05:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139