交叉编译器默认包含路径设置 [英] Cross compiler default include path setup

查看:559
本文介绍了交叉编译器默认包含路径设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,介绍一些背景知识:我试图在Beagleboard-xM上为Android编写驱动程序和应用程序。

我已经下载了他们的android开发工具包,并安装了它,并且可以使用 http://processors.wiki.ti.com/index.php/TI- Android-ICS-4.0.3-DevKit-3.0.0_DevelopersGuide



我已经能够按照 http://tldp.org/LDP/lkmpg/2.6/lkmpg.pdf 的问题。我可以将.ko文件复制到Android设备,insmod,rmmod等。



我厌倦了默认构建的基本shell,并认为我会添加busybox。我尝试了 http://omappedia.org/wiki/Android_Installing_Busybox_Command_Line_Tools 中的指示,但我得到了编译标准libc头文件时出错。



经过深入研究,我确定TI android开发套件中提供的预构建交叉编译器不是'寻找正确的路径。

我通过创建自己的.c文件来证实这一点,该文件包含并试图用
arm-eabi-gcc blah.c -o进行编译blah
并且遇到了相同的结果(无法找到相关头文件)

'arm-eabi-gcc -print-prog-name = cc1'-v 给我这个:


  • 忽略不存在的目录
    / usr / local / google / home / android / cupcake_rel_root / usr / local / include

  • 忽略不存在的目录/usr/local/lib/gcc/arm-eabi/4.4.3/包括

  • 忽略不存在的目录/usr/local/lib/gcc/arm-eabi/4.4.3/include-fixed

  • 忽略不存在的目录/usr/local/lib/../arm-eabi/include

  • 忽略不存在的目录/ usr / local / google / home / android / cupcake_rel_root / usr / include



这些路径在全新安装的ubuntu 10.04上都不存在。我使用的交叉编译器位于 /usr/TI-Android/prebuilt/linux-86/toolchain/arm-eabi-4.4.3/ 。我没有做任何事情,除了运行android开发工具包中的.bin文件(这看起来更像是简单地将它从.bin文件中提取出来;我不记得它做任何其他事情)。

所以,有几个问题:


  1. heck如何做其他事情(例如android,x-loader, u-boot,内核)通过将交叉编译工具的bin放入$ PATH中来构建(就像how-to文档所说的那样)。我认为它(make menuconfig?)在修复基于可执行文件位置的include路径方面做了一些神奇的工作,但是...
  2. 为什么busybox不能以相同的方式工作它似乎是用类似的基础设施构建的?

  3. 我如何制作它,以便我可以交叉编译自己的应用程序?

我假设我错过了一个步骤,应该在预构建的交叉编译器上进行某种安装/配置,但是信息非常少。我呼吁你,开源的神灵,指引我穿越这个黑暗和暴风雨的大海。

包含在android开发工具包中的预构建工具仅足以构建内核,不包含libc或其他库头文件。 (NDK工具是'不同的',而且构建环境更加不同,因为它有它自己的libc版本 - 仿生。这个构建环境可能已经能够建立我想要的,但是我必须使用Androidy makefiles等)



我最终必须获得Code Sourcery arm-none-linux-gnueabi (必须获得linux-gnueabi一个有需要的Linux系统头文件),并且在此之后,一切工作都能顺利进行。


First, some background: I'm attempting to write drivers and applications for Android on the Beagleboard-xM.

I've downloaded their android development kit, installed it, and can succesfully build everything in it using the directions at http://processors.wiki.ti.com/index.php/TI-Android-ICS-4.0.3-DevKit-3.0.0_DevelopersGuide

I've been able to make my own skeleton kernel module following the steps in http://tldp.org/LDP/lkmpg/2.6/lkmpg.pdf without issues. I can copy the .ko file to the android device, insmod, rmmod, etc.

I got tired of the basic shell given by the default build and thought I'd add busybox. I tried following the directions at http://omappedia.org/wiki/Android_Installing_Busybox_Command_Line_Tools, but I get a compile error on standard libc header files.

After digging around quite a bit, I've determined that the pre-built cross compiler provided in the TI android development kit wasn't searching the right paths.

I confirmed this by creating my own .c file that included and tried to compile it with arm-eabi-gcc blah.c -o blah and was met with the same results (unable to find the header file in question)

'arm-eabi-gcc -print-prog-name=cc1' -v gives me this:

  • ignoring nonexistent directory "/usr/local/google/home/android/cupcake_rel_root/usr/local/include"
  • ignoring nonexistent directory "/usr/local/lib/gcc/arm-eabi/4.4.3/include"
  • ignoring nonexistent directory "/usr/local/lib/gcc/arm-eabi/4.4.3/include-fixed"
  • ignoring nonexistent directory "/usr/local/lib/../arm-eabi/include"
  • ignoring nonexistent directory "/usr/local/google/home/android/cupcake_rel_root/usr/include"

None of these paths ever existed on my fresh install of ubuntu 10.04. My cross compiler I used is at /usr/TI-Android/prebuilt/linux-86/toolchain/arm-eabi-4.4.3/. I didn't do anything except run the bit .bin file that was the android development kit (which seemed more like simply extracting itself from the .bin file; I don't remember it doing anything else)

So, a few questions:

  1. how the heck did everything else (i.e. android, x-loader, u-boot, the kernel) build by just putting the bin of the cross compile tool into $PATH (like the how-to documents say). I assume it (make menuconfig?) does some magic in fixing up the include paths based on the location of the executable, but...
  2. Why doesn't busybox work the same way since it seems to be built with a similar looking infrastructure?
  3. How do I make it so I can cross compile my own applications?

I assume I've missed a step and should have done some sort of install/configure on the pre-built cross compiler, but information is horribly scant. I appeal to you, open source gods, to point my way across this dark and stormy sea.

解决方案

For posterity, it seems that the prebuilt tools included with the android development kit are only enough to build the kernel and don't include libc or other library header files. (The NDK tools are 'different' and the build environment is even more different because it has its own version of libc--bionic. That build environment might have been able to build what I wanted, but I would have had to muck with Androidy makefiles, etc.)

I ended up having to get Code Sourcery arm-none-linux-gnueabi (must get the linux-gnueabi one to have the linux system header files needed), and everything worked reasonably smoothly after that.

这篇关于交叉编译器默认包含路径设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆