判断当前所用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/