gcc 與 glibc 的關系 glibc版本查看


glibc是什么,以及與gcc的關系?
glibc是gnu發布的libc庫,也即c運行庫。glibc是linux 系統中最底層的api(應用程序開發接口),幾乎其它任何的運行庫都會倚賴於glibc。glibc除了封裝linux操作系統所提供的系統服務外,它本 身也提供了許多其它一些必要功能服務的實現,主要的如下:
(1)string,字符串處理
(2)signal,信號處理
(3)dlfcn,管理共享庫的動態加載
(4)direct,文件目錄操作
(5)elf,共享庫的動態加載器,也即interpreter
(6)iconv,不同字符集的編碼轉換
(7)inet,socket接口的實現
(8)intl,國際化,也即gettext的實現
(9)io
(10)linuxthreads
(11)locale,本地化
(12)login,虛擬終端設備的管理,及系統的安全訪問
(13)malloc,動態內存的分配與管理
(14)nis
(15)stdlib,其它基本功能
gcc 是編譯器,基本上 Linux 下所有的程序(包括內核)都是 gcc 編譯的,libc 當然也是。
gcc 和 libc 是互相依賴的兩個軟件,它們合作的方式類似 Linux 系統的 "自舉"。先在一個可以運行的帶有老 libc 和 gcc 的系統上,用老 gcc 編譯出一個新版本的 gcc + 老 libc,再用這個新 gcc 編譯出一個新 gcc + 新 libc,再用這套東東編譯整個新系統。

 

glibc版本查看

4.9.	How can I find out which version of glibc I am using in the moment?

{UD} If you want to find out about the version from the command line simply
run the libc binary.  This is probably not possible on all platforms but
where it is simply locate the libc DSO and start it as an application.  On
Linux like

	/lib/libc.so.6

This will produce all the information you need.

What always will work is to use the API glibc provides.  Compile and run the
following little program to get the version information:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#include <gnu/libc-version.h>
int main (void) { puts (gnu_get_libc_version ()); return 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This interface can also obviously be used to perform tests at runtime if
this should be necessary.

 

Just execute:

ldd --version

which comes with glibc package


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM