zoukankan      html  css  js  c++  java
  • 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


    *但是,在ARM板上,不能通过 1)/lib/libc.so.6 2)ldd --version 命令查看到相应的gLibc版本,如何直接用命令查看呢?




  • 相关阅读:
    zookeeper分布式锁和服务优化配置
    【转】从Mac/OS和iOS开放源码浅谈UNIX家谱
    【转】深入了解CPU两大架构ARM与X86
    【转】volatile关键字。编译器不优化,多线程会改。防止随时变动的
    栈,寄存器,局部变量,内存,语言级别优化程序的方法
    在coursera上有哪些值得推荐的课程
    【转】楼天城楼教主的acm心路历程(作为励志用)
    硬中断软中断
    CPU GPU FPU TPU 及厂商
    C#中使用DLL相关问题
  • 原文地址:https://www.cnblogs.com/jiqiubo/p/2126117.html
Copyright © 2011-2022 走看看