Depending on library, ubuntu stores its libraries mainly in three locations
/lib
/usr/lib
/usr/local/lib
Following is from File System Hierarchy Standard
/lib
The /lib directory contains those
shared library images needed to boot
the system and run the commands in the
root filesystem, ie. by binaries in
/bin and /sbin.
/usr/lib
/usr/lib includes object files,
libraries, and internal binaries that
are not intended to be executed
directly by users or shell scripts.
[22]
Applications may use a single
subdirectory under /usr/lib. If an
application uses a subdirectory, all
architecture-dependent data
exclusively used by the application
must be placed within that
subdirectory.
/usr/local/lib contains local libraries i.e one specific for this system but I can not find references to /usr/local/lib in FHS, it only contains explanation for /usr/local.
Based on your comments to your question, I think what you are really asking is "How do I install a custom library I wrote and where should I put it?"
In general, things built locally for others on the machine to user are put into the /usr/local tree. The header file should go into /usr/local/include. The compiled library should go into /usr/local/lib. The .c file is not part of the library, it is part of the source and not something normally not installed for the use of the end user. You will need root access to put files in either of these locations.
To build the library, you will need to build first decide if you want a static or dynamic (shared) library. More information on creating a shared library can be foundin section 3.4, Creating a Shared Library at http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html. (They also have recommendation about where to put stuff -- most developers will have an an opinion or three :-) )
You should tell the compiler, where it can find your library. Assumed, the path to your library is "/path/to/lib/libfoo.a", you could compile and link your program "hello.c" like this:
gcc -L/path/to/lib -lfoo hello.c
This is not specific to Ubuntu, actually all C-compilers I know support those flags.
Depending on library, ubuntu stores its libraries mainly in three locations
Following is from File System Hierarchy Standard
/lib
/usr/lib
/usr/local/lib contains local libraries i.e one specific for this system but I can not find references to /usr/local/lib in FHS, it only contains explanation for /usr/local.
Based on your comments to your question, I think what you are really asking is "How do I install a custom library I wrote and where should I put it?"
In general, things built locally for others on the machine to user are put into the /usr/local tree. The header file should go into /usr/local/include. The compiled library should go into /usr/local/lib. The .c file is not part of the library, it is part of the source and not something normally not installed for the use of the end user. You will need root access to put files in either of these locations.
To build the library, you will need to build first decide if you want a static or dynamic (shared) library. More information on creating a shared library can be foundin section 3.4, Creating a Shared Library at http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html. (They also have recommendation about where to put stuff -- most developers will have an an opinion or three :-) )
Ubuntu follows Filesystem Hierarchy Standard (http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard), regular applications libraries should be stored under /usr/lib .
Please note that developing/managing libraries is not a trivial subject, you should read some more detailed documentation, here is a nice tutorial: http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
You should tell the compiler, where it can find your library. Assumed, the path to your library is "/path/to/lib/libfoo.a", you could compile and link your program "hello.c" like this:
This is not specific to Ubuntu, actually all C-compilers I know support those flags.
In Ubuntu they are found in
/usr/include
.