歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Mac OS X Lion 下編譯Android 源碼

Mac OS X Lion 下編譯Android 源碼

日期:2017/3/1 10:21:02   编辑:Linux編程

在Mac OS X Lion編譯Android 源碼,按照官網和網上的資料進行時,我遇到了一些問題,總結一下:

1、錯誤信息:

./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

網上的資料說打開./external/elfutils/config-compat-darwin.h這個文件,把

static inline size_t strnlen (const char *__string, size_t __maxlen)

{

int len = 0;

while (__maxlen-- && *__string++)

len++;

return len;

} 這個函數用宏給括起來,我干脆給刪掉了,當然先把這個文件給備份了。

再次執行make時

2、錯誤信息

Undefined symbols for architecture i386:

網上資料說把external/qemu/Android.mk這個文件全部注釋掉

再次執行make,就沒有出現error了,並在/out/target/product/generic下面生成了ramdisk.img,system.img,userdata.img三個文件。

我用的是make -j8 ,我的是4核,8個G的內存。

更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11

Copyright © Linux教程網 All Rights Reserved