其他分享
首页 > 其他分享> > 判断当前所用C库是glibc还是uclibc

判断当前所用C库是glibc还是uclibc

作者:互联网

1.准备测试代码

#include <stdio.h>

int main(void)
{
    printf("hello\n");
    return 0;
}

2.使用-v选项,编译

gcc -v test.c

3.分析输出

1.查看头文件目录中,有没有uclibc输出字段中

#include "..." search starts here:
#include <...> search starts here:
 /home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/include
 /home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/include-fixed/uclibc
 /home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/include
 /home/hany/work/t40/mips-gcc720-glibc226/bin/../mips-linux-gnu/libc/uclibc/usr/include
End of search list.

2.查看LIBRARY_PATH中有没有uclibc

LIBRARY_PATH=/home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/uclibc/:/home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/lib/uclibc/:/home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/:/home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/:/home/hany/work/t40/mips-gcc720-glibc226/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/lib/:/home/hany/work/t40/mips-gcc720-glibc226/bin/../mips-linux-gnu/libc/uclibc/lib/:/home/hany/work/t40/mips-gcc720-glibc226/bin/../mips-linux-gnu/libc/uclibc/usr/lib/

标签:lib,uclibc,..,gnu,glibc,库是,linux,mips,gcc720
来源: https://www.cnblogs.com/hanyli/p/15466198.html