在Mac OS X Lion 下编译Android 源码出现的一个问题

 

出错原因:

./external/elfutils/config-compat-darwin.h:42: error: static declaration of ‘strnlen’ follows non-static declaration

/usr/include/string.h:143: error: previous declaration of ‘strnlen’ was here

make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libelf_intermediates/lib/xmalloc.o] Error 1

 

解决方案:参考别人些的文章

http://blog.sephiroth.it/2011/10/17/compiling-android-source-on-mac-lion/

 

modify ./external/elfutils/config-compat-darwin.h.
replace:








static  inline  size_t strnlen  ( const  char  *__string ,  size_t __maxlen )
{
int len  =  0 ;
while  (__maxlen --  &&  *__string ++ )
len ++;
return len ;
}

with:









#if 0
static  inline  size_t strnlen  ( const  char  *__string ,  size_t __maxlen )
{
int len  =  0 ;
while  (__maxlen --  &&  *__string ++ )
len ++;
return len ;
}
#endif

Well, at the end of the process I just edited the Android.mk makefile into external/skia adding a new entry for BUILD_STATIC_LIBRARY and the next command was simply:


mmm external/skia

which produced the required libskia.a file to be linked in my project.

 

 

 

 

 

 

 

 

 

第二个问题:

warning: ignoring file out/host/darwin-x86/obj/STATIC_LIBRARIES/ 
libSDL_intermediates/libSDL.a, file was built for archive which is not 
the architecture being linked (i386) 
Undefined symbols for architecture i386: 

 

 

Do this by commenting out all lines in

external/qemu/Android.mk



The toolchain problem stems from the fact that Android actually supports the mac toolchain from Snow Leopard and onwards. So put homebrew path LAST in $PATH, so that it uses the Mac toolchain first.

When building DevNull/Oxygen ROM you in addition to the steps above also need to make a symlink in /usr/local/bin from sed to gsed, since they explicitly call gsed at one point. Also you have to disable WITH_DEXPREOPT like so:

make -j8 [devnull] WITH_DEXPREOPT=false

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值