• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

where to place library files under linux


Is there any common place you put libraries used for developing apps under linux? When developing for win32, I  usually make a folder under C:\ called "lib". Then all users can access any library under c:\lib.

Under linux, it seems there's already a folder called "lib". Is it proper to dump my libraries into there, or should I create some separate folder to differentiate? Also, it looks like in the /usr folder on my system we have a copy of the lib folder - what is the purpose of having /lib, and then usr/lib?

  • 2
1 Solution
Under Linux, that's quite similar - it *is* '/usr/lib', as you assumed above. http://www.tldp.org/HOWTO/Program-Library-HOWTO/index.html ("Program Library HOWTO") adresses that also, I already mentioned that HOWTO in an earlier question of yours.
BTW, to reference a particular library that is not placed there, use


to specify that directory on teh compiler's/linker's command line. As the man page says:

      -Ldir  Add  directory dir to the list of directories to be
             searched for `-l'.

             Use the library named library when linking.

             The  linker searches a standard list of directories
             for the library, which is  actually  a  file  named
             `liblibrary.a'.   The linker then uses this file as
             if it had been specified precisely by name.

             The directories searched include  several  standard
             system  directories  plus any that you specify with
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now