问一个交叉编译环境的问题

晨与飞扬 2013-10-10 09:49:30
环境:ubuntu 12.04 lts 64位
android 源代码版本4.0.4

问题:
android 源代码prebuilt/linux-x86/toolchain目录下的交叉编译工具,
和在http://www.mentor.com/网站上下载的交叉编译工具(arm-2013.05-24-arm-none-linux-gnueabi.bin),
有什么区别?


写了一小程序。
#include <stdio.h>

int main()
{
printf("hello word\n");

return 0;
}

使用android的交叉编译工具结果如下:

themitec@themitec-945GZM-S2:~/cpp$ arm-eabi-gcc -o he hellow.c
hellow.c:1:19: error: stdio.h: No such file or directory
hellow.c: In function 'main':
hellow.c:5: warning: incompatible implicit declaration of built-in function 'printf'


使用下载的交叉编译工具,就正常给编译通过。放到开发板上运行正常。

themitec@themitec-945GZM-S2:~/cpp$ arm-none-linux-gnueabi-gcc -static -o hellow hellow.c
themitec@themitec-945GZM-S2:~/cpp$ ll
总用量 652
drwxrwxr-x 2 themitec themitec 4096 10月 10 09:43 ./
drwxr-xr-x 33 themitec themitec 4096 10月 10 09:28 ../
-rwxrwxr-x 1 themitec themitec 654853 10月 10 09:43 hellow*
-rw-rw-r-- 1 themitec themitec 79 10月 9 17:14 hellow.c
themitec@themitec-945GZM-S2:~/cpp$

这是为什么呢?它们的区别是啥?高手不吝赐教。
...全文
150 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
voice_shen 2013-10-14
  • 打赏
  • 举报
回复
Android使用的是Bionic libC库 Mentor toolchain使用glibc库
woshigening 2013-10-13
  • 打赏
  • 举报
回复
android的交叉编译工具的配置里面函数库的位置不对

21,600

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧