Reputation: 29178
In the gcc manual it is given that "The C standard library itself is stored in ‘/usr/lib/libc.a’". I have gcc installed, but could not find libc.a at the said location. Curious to know where is it located.
I find many .so files in /usr/lib location. What are those?
Upvotes: 53
Views: 131751
Reputation: 61910
If you are on RPM based Linux (Red Hat/CentOS/Fedora/SUSE) then you would get the location of the installed glibc with
rpm -ql glibc
and rpm -ql glibc-devel
.
locate libc.a
would get you the location. And to see from where it comes do:
rpm -qf /usr/lib/libc.a
Here is what rpm -qi
has to tell about these packages
glibc-devel:
The glibc-devel package contains the object files necessary for developing programs which use the standard C libraries (which are used by nearly all programs). If you are developing programs which will use the standard C libraries, your system needs to have these standard object files available in order to create the executables. Install glibc-devel if you are going to develop programs which will use the standard C libraries
glibc:
The glibc package contains standard libraries which are used by multiple programs on the system. In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs. This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function.
Upvotes: 9
Reputation: 1029
If you are looking for libc.a
:
$ gcc --print-file-name=libc.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libc.a
Upvotes: 62
Reputation: 139
You need to install package for static libraries separately: glibc-static.i686
Upvotes: 3
Reputation: 21
On centos 5.8
$ ls -l /usr/lib/libc.a
-rw-r--r-- 1 root root 2442786 Apr 8 2010 /usr/lib/libc.a
$ rpm -qf /usr/lib/libc.a
glibc-devel-2.3.4-2.43.el4_8.3
You also have to have the glibc-devel
package install under RedHat distributions.
Upvotes: 2
Reputation: 48775
A few things:
.a
files are static libraries, .so
means shared object and is the Linux equivalent of a DLLHope that clears it up for you. As for the location, it's almost certainly going to be in /usr/lib/libc.a
and / or /usr/lib/libc.so
. Like I said, the .so one is the more common.
Upvotes: 37