交叉编译静态C的hello world为Android使用手臂的Linux gnueabi-GCC静态、手臂、world、Android

由网友(﹏岁月的颓废丶)分享简介:我想用臂的Linux gnueabi - 海湾合作委员会,而不是使用NDK的独立工具链或codesourcery为此事建立一个静态的Hello World从C。I want to build a static hello world from C using arm-linux-gnueabi-gcc as opp...

我想用臂的Linux gnueabi - 海湾合作委员会,而不是使用NDK的独立工具链或codesourcery为此事建立一个静态的Hello World从C。

I want to build a static hello world from C using arm-linux-gnueabi-gcc as opposed to using the NDK standalone toolchain or Codesourcery for that matter.

在Ubuntu的...

In Ubuntu...

我也做了以下内容:

sudo apt-get install gcc-arm-linux-gnueabi

我创造了这样一个hi.c:

I created a hi.c like this:

#include <stdio.h>

int main(int argc, char** argv) {
   printf("hello worldn");
   return 0;
}

我编这是这样的:

I have compiled it like this:

arm-linux-gnueabi-gcc -static hi.c -o hi 

我跑了它在这样一个仿真器:

I ran it on an emulator like this:

adb push hi /data/hi
adb shell /data/hi

不过,我得到这样的:

But, I get this:

[1]   Illegal instruction     /data/hi

有哪些步骤我忘了吗?根据以往的经验,这应该工作过,但我显然搞砸这件事。

What step have I forgot? Based on past experience this "should" have worked, but I obviously messed this up.

推荐答案

如果我这样做是Debian机(VM在我的情况)时,一切似乎都很好。我不知道什么时候不好做Ubuntu的相似。这可能是因为狮子座的建议,但我无法证实。这应该给你,虽然工作。

If I do this on a Debian machine (VM in my case), all seems well. I am not sure what when wrong with doing similar on ubuntu. It could be as Leo suggested, but I cannot confirm. This should work for you though.

的http://www.cnx-software.com/2012/01/16/installing-emdebian-arm-cross-toolchain-in-debian/

有人加入此链接,但它不使用I在说明书中提到的工具链。离开它如果有人有兴趣。

Someone added this link, but it is not using the toolchain I mentioned in the description. Leaving it in case anyone is interested.

的http://tariqzubairy.word$p$pss.com/2012/03/09/arm-binaries-static-library-for-android/

阅读全文

相关推荐

最新文章