cross compiling in Linux for android(arm_linux) platform

There are two ways in cross compiling for android platform.

First, make use of arm-none-linux-gnueabi toolchain, you can download it from the following url: http://www.codesourcery.com/gnu_toolchains/arm/portal/package3399/public/arm-none-linux-gnueabi/arm-2008q3-41-arm-none-linux-gnueabi.bin

Second, use arm-gnueabi toolchain which is in NDK of Android.

 

Now I will tell how to cross compile for android platform by an example of compiling CyberGarage.

 

1.      Firstly, introduce the method how to make use of arm-gnueabi toolchain. (The following referred three scripts can be extracted from attachment ” shell_cross_compiling_by_ndk.zip”)

 

a.      Download SDK and NDK from Android official web

b.      Build Android develop environment

c.      Download Expat XML Parser on which is relied by CyberGarage: http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download

d.      Download project CyberGarage for C from http://www.cybergarage.org/twiki/bin/view/Main/CyberLinkForC

e.      Edit /etc/profile in order to add ${path}: export PATH=${PATH}:/root/Desktop/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin

f.       1) Put “config_shell_expat” into folder “expat-2.0.1”;

2) #./config_shell_expat; (it will generate Makefile and libtool);

3) Set the line

deplibs_check_method=”pass_all”

instead of

deplibs_check_method=”unknown”

which is contained in the “libtool” script (Why need to change libtool? Because crtbegin_dynamic.o and crtend_android.o in NDK is not generated by libtool. Therefore I can say toolchain in NDK is not very perfect for porting. It needs further update in the future);

4) #make

5) #make install

g.      1) Put “config_shell_clinkc” into folder “clinkc-2.3”;

2) #./config_shell_clinkc;

3) Set the line

deplibs_check_method=”pass_all”

instead of

deplibs_check_method=”unknown”

which is contained in the “libtool” script;

4) #make

5) #make install

h.      1) Put file “make_shell” into application source folder;

2) #./make_shell;

3) you can get application under source folder

 

2.      Then how to make use of arm-none-linux-gnueabi toolchain. (The following referred three scripts can be extracted from attachment ” shell_cross_compiling_by_gnu.zip”)

 

a.      Download arm-none-linux-gnueabi from codesourcery;

b.      Edit /etc/profile in order to add ${path}: export PATH=${PATH}:/root/CodeSourcery/Sourcery_G++_Lite/bin

c.      1) Put “config_shell_expat_gnu” into folder “expat-2.0.1”;

2) #./config_shell_expat_gnu; (it will generate Makefile and libtool);

3) #make

4) #make install

d.      1) Put “config_shell_clinkc_gnu” into folder “clinkc-2.3”;

2) #./config_shell_clinkc_gnu;

3) #make

4) #make install

e.      1) Put file “make_shell_gnu” into application source folder;

2) #./make_shell_gnu;

3) you can get application under source folder

 

The above two methods have been verified. If any questions, pls email me.

Thank you

 

Joshua

2010-10-20

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值