在mac os X下编译android源代码(10.9)

时间:2013-11-02 13:09:53

标签: android

我目前正在运行Mac OS X(10.9),以及编译android源代码的一些问题。 我在区分大小写的磁盘(/ Volume / android)下载android源代码,按照这个 网站http://source.android.com/source/downloading.html并制作版本3.81。 以下是我的〜/ .bash_profile

的一部分
    ===================================================================================================
function mountAndroid { hdiutil attach ~/android.dmg.sparseimage -mountpoint /Volumes/android; }
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# set the number of open files to be 1024
ulimit -S -n 1024
PATH=~/bin:$PATH

##
# Your previous /Users/chousodaera/.bash_profile file was backed up as /Users/chousodaera/.bash_profile.macports-saved_2013-11-01_at_12:37:13
##

# MacPorts Installer addition on 2013-11-01_at_12:37:13: adding an appropriate PATH variable for use with MacPorts.
 export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
===================================================================================================

但我仍然编译android源代码失败。 有没有人有任何想法帮助我解决这个问题? 贝娄是我的错误信息。

choumato-MacBook-Pro:android chousodaera$ make
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=darwin
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================

host C: acp <= build/tools/acp/acp.c
build/tools/acp/acp.c:11:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
         ^
1 error generated.
make: *** [out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1

1 个答案:

答案 0 :(得分:0)

这是因为您尚未在Mac OS中正确设置构建环境。从Apple开发人员站点安装Xcode以及命令行utils。另外,确保/ opt / local / bin出现在/ usr / bin之前的路径中。

export PATH=/opt/local/bin:$PATH

使用此作为设置构建环境的参考:https://source.android.com/source/initializing.html