Results 1 to 7 of 7

Thread: Making use of /usr/local/lib

  1. #1
    Join Date
    Nov 2005
    Beans
    403
    Distro
    Ubuntu Development Release

    Making use of /usr/local/lib

    I've tried installing from source some libraries which end up in /usr/local. When running programs that make use of these libraries, I find that I can't access them---the system doesn't search /usr/local/lib for shared library files.

    How do I make it do this?

    I know that one way is to use add export LD_LIBRARY_PATH = /usr/local/lib:$LD_LIBRARY_PATH to my .bashrc_profile, but I was wondering if there's a more general way that simply tells the whole system to search /usr/local/lib as well as /usr/lib.

    As a related question, what command do I use to find out what the library path currently is?

    Many thanks,

    -- Joe

  2. #2
    Join Date
    Dec 2006
    Location
    Uk
    Beans
    109

    Re: Making use of /usr/local/lib

    Add /usr/local/lib to /etc/ld.so.conf then run ldconfig

    A web serach for ld.so.conf or ldconfig should turn up plently of info.

  3. #3
    Join Date
    Jul 2005
    Beans
    1,535
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Making use of /usr/local/lib

    Quote Originally Posted by WebDrake View Post
    ... I was wondering if there's a more general way that simply tells the whole system to search /usr/local/lib as well as /usr/lib.
    You can edit the file /etc/ld.so.conf (you might have to create the file if it does not exist) and add
    Code:
    /usr/local/lib
    to the file. You then have to update the cache by running
    Code:
    sudo ldconfig
    As a related question, what command do I use to find out what the library path currently is?
    I'm not sure how to get just the directories, but you can use ldconfig to print directories and libraries in its cache.
    Code:
    ldconfig -p
    A combination of that command and some scripting could potentially get just the dirs. I'm not sure if there is a better command for retrieving only the dirs.
    When I invented the Web, I didn't have to ask anyone's permission.
    ~Tim Berners-Lee on Net Neutrality
    -------------------------------------
    Visit the Ubuntu Programming IRC-channel at #ubuntu-programming (chat.freenode.net).

  4. #4
    Join Date
    Nov 2005
    Beans
    403
    Distro
    Ubuntu Development Release

    Re: Making use of /usr/local/lib

    Many thanks for these great replies which solved the problem completely.

  5. #5
    Join Date
    Apr 2005
    Beans
    218
    Distro
    Kubuntu Development Release

    Re: Making use of /usr/local/lib

    (Sorry about the necromancy. I've got a very much related question and thought there was no point starting an all-new thread for it.)

    I'm working on a little game that consists of, among other things, a bunch of executables and a shared library (written by other people; they provide the runtime environment for what I'm doing).

    I want people to be able to plunk the contents of my tarball wherever they want, be it their home directory, or /opt, or (where I believe it would belong:) /usr/local.

    But of course /usr/local/lib (where the shared library would then go) isn't "active" by default.

    Since there's a launcher shell script invovled, I could easily have the script look for the library (how? wild guesses?) and then change LD_LIBRARY_PATH accordingly before running the actual executable. That should work and would not alter people's systems.

    But is that a good way to do it?

    I'm a bit uncertain because /usr/local/lib is so utterly empty, as if one wasn't supposed to use it at all.
    Last edited by mrowth; March 8th, 2009 at 06:59 PM.

  6. #6
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: Making use of /usr/local/lib

    Quote Originally Posted by mrowth View Post
    ...
    But of course /usr/local/lib (where the shared library would then go) isn't "active" by default.
    ...
    It is on some linux distros, but not all. It is setup with Ubuntu 8.10. Now I cannot recall if it was setup or not with 8.04. Ditto with whether it was setup with Fedora 9. I remember having an issue with one of these older distros, and I want to say it was with 8.04, but I'm not certain.

  7. #7
    Join Date
    Apr 2005
    Beans
    218
    Distro
    Kubuntu Development Release

    Re: Making use of /usr/local/lib

    Quote Originally Posted by dwhitney67 View Post
    It is on some linux distros, but not all. It is setup with Ubuntu 8.10. Now I cannot recall if it was setup or not with 8.04. Ditto with whether it was setup with Fedora 9. I remember having an issue with one of these older distros, and I want to say it was with 8.04, but I'm not certain.
    /usr/local/lib does seem to be in use elsewhere (going by my googling anyway) - but not on 8.04, which both the original poster and I are/were using. Good to know I might not be trying to do something especially silly...

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
  •