嵌入式编译器 查看库文件依赖关系

 
关于使用glibc库(修改: 2011.7.13)
可以先到google上搜索一下glibc了解大概,对于嵌入式系统的glibc库来说,只需加载器和动态库。
 
在制作交叉编译器的时候,已经生成了glibc库,可以直接使用。我使用的是openmoko团队制作的arm-linux-gcc 4.1.2版本编译器。加载器为/opt/toolchains/arm920t-eabi/arm-angstrom-linux-gnueabi/lib/目录下的ld-2.5.so  ld-linux.so.3文件。其他动态库可根据运行程序需要来加载。
 
eg:编写一个test.c程序。
  1. #include <stdio.h>

  2. int main()
  3. {
  4.     printf("Hello,world!\n");
  5.     return 1;
  6. }
编译:#arm-linux-gcc test.c -o test
查看库文件依赖关系: arm-linux-readelf -a test | grep "Shared

可知:程序test依赖的库文件为libc.so.6,到交叉编译器中找到该文件即是。
 
也可以直接把程序copy到开发板,运行该程序,或提示出现缺少libc.so.6库文件的。
 
转载地址
http://my.chinaunix.net/space.php?uid=7876309&do=blog&id=1689320

你可能感兴趣的:(Google,嵌入式,编译器)