原始的error log:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=darwin
HOST_BUILD_TYPE=release
BUILD_ID=GWK74
============================================
find: frameworks/base/frameworks/base/docs/html: No such file or directory
find: out/target/common/docs/gen: No such file or directory
find: frameworks/base/frameworks/base/docs/html: No such file or directory
find: out/target/common/docs/gen: No such file or directory
find: frameworks/base/frameworks/base/docs/html: No such file or directory
find: out/target/common/docs/gen: No such file or directory
find: frameworks/base/frameworks/base/docs/html: No such file or directory
find: out/target/common/docs/gen: No such file or directory
find: frameworks/base/frameworks/base/docs/html: No such file or directory
find: out/target/common/docs/gen: No such file or directory
host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_util.c
host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_cs.c
host C: libneo_util <= external/clearsilver/util/neo_files.c
host StaticLib: libhost (out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
echo out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/CopyFile.o | xargs ar cqs out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a
external/clearsilver/util/neo_files.c::: error: expected expression
return nerr_raise(NERR_ASSERT, "Invalid call to ne_listdir_fmatch");
^
external/clearsilver/util/neo_err.h::: note: expanded from macro
'nerr_raise'
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
^
error generated.
host C: libneo_util <= external/clearsilver/util/ulist.c
make: *** [out/host/darwin-x86/obj/SHARED_LIBRARIES/libneo_util_intermediates/neo_files.o] Error
make: *** Waiting for unfinished jobs....
external/clearsilver/java-jni/j_neo_util.c::: error: expected expression
return nerr_raise(NERR_ASSERT,
^
external/clearsilver/java-jni/../util/neo_err.h::: note: expanded from macro
'nerr_raise'
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
^
external/clearsilver/java-jni/j_neo_util.c::: error: expected expression
return nerr_raise(NERR_ASSERT,
^
external/clearsilver/java-jni/../util/neo_err.h::: note: expanded from macro
'nerr_raise'
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
^
errors generated.
make: *** [out/host/darwin-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] Error
external/clearsilver/util/ulist.c::: error: expected expression
return nerr_raise(NERR_NOMEM, "Unable to create ULIST: Out of memory");
^
external/clearsilver/util/neo_err.h::: note: expanded from macro
'nerr_raise'
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
^
external/clearsilver/util/ulist.c::: error: expected expression
return nerr_raise(NERR_NOMEM, "Unable to create ULIST: Out of memory");
^
external/clearsilver/util/neo_err.h::: note: expanded from macro
'nerr_raise'
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
^
external/clearsilver/util/ulist.c::: error: expected expression
return nerr_raise(NERR_OUTOFRANGE, "uListPop: empty list");
^
external/clearsilver/util/neo_err.h::: note: expanded from macro
'nerr_raise'
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
^
errors generated.
make: *** [out/host/darwin-x86/obj/SHARED_LIBRARIES/libneo_util_intermediates/ulist.o] Error
以“error: expected expression return nerr_raise(NERR_ASSERT,” 为keyword找到:
https://groups.google.com/forum/#!msg/android-building/Vhw56NONaAM/GLfo0yfnsB4J
这贴里面这位Josh老兄给出的解法:
The following should fix this:
$ sudo mv /usr/bin/cc /usr/bin/cc.bak
$ sudo mv /usr/bin/c++ /usr/bin/c++.bak
$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/cc
$ sudo ln -s /usr/bin/llvm-g++-4.2 /usr/bin/c++
哦,原来是OSX下默认的compiler指向的问题, AOSP要使用gcc和g++,而原始的link指向是:
cc->clang
c++->clang++
(Clang: http://en.wikipedia.org/wiki/Clang)
所以我们需要将之前的link断开, 设置为gcc和g++。
$ sudo rm /usr/bin/cc /usr/bin/c++
$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/cc
$ sudo ln -s /usr/bin/llvm-g++-4.2 /usr/bin/c++
问题解决。