原始的error log:
1 ============================================ 2 PLATFORM_VERSION_CODENAME=REL 3 PLATFORM_VERSION=2.3.7 4 TARGET_PRODUCT=generic 5 TARGET_BUILD_VARIANT=eng 6 TARGET_SIMULATOR= 7 TARGET_BUILD_TYPE=release 8 TARGET_BUILD_APPS= 9 TARGET_ARCH=arm10 HOST_ARCH=x8611 HOST_OS=darwin12 HOST_BUILD_TYPE=release13 BUILD_ID=GWK7414 ============================================15 find: frameworks/base/frameworks/base/docs/html: No such file or directory16 find: out/target/common/docs/gen: No such file or directory17 find: frameworks/base/frameworks/base/docs/html: No such file or directory18 find: out/target/common/docs/gen: No such file or directory19 find: frameworks/base/frameworks/base/docs/html: No such file or directory20 find: out/target/common/docs/gen: No such file or directory21 find: frameworks/base/frameworks/base/docs/html: No such file or directory22 find: out/target/common/docs/gen: No such file or directory23 find: frameworks/base/frameworks/base/docs/html: No such file or directory24 find: out/target/common/docs/gen: No such file or directory25 host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_util.c26 host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_cs.c27 host C: libneo_util <= external/clearsilver/util/neo_files.c28 host StaticLib: libhost (out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)29 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.a30 external/clearsilver/util/neo_files.c:219:12: error: expected expression31 return nerr_raise(NERR_ASSERT, "Invalid call to ne_listdir_fmatch");32 ^33 external/clearsilver/util/neo_err.h:88:69: note: expanded from macro34 'nerr_raise'35 nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)36 ^37 1 error generated.38 host C: libneo_util <= external/clearsilver/util/ulist.c39 make: *** [out/host/darwin-x86/obj/SHARED_LIBRARIES/libneo_util_intermediates/neo_files.o] Error 140 make: *** Waiting for unfinished jobs....41 external/clearsilver/java-jni/j_neo_util.c:257:12: error: expected expression42 return nerr_raise(NERR_ASSERT,43 ^44 external/clearsilver/java-jni/../util/neo_err.h:88:69: note: expanded from macro45 'nerr_raise'46 nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)47 ^48 external/clearsilver/java-jni/j_neo_util.c:268:12: error: expected expression49 return nerr_raise(NERR_ASSERT,50 ^51 external/clearsilver/java-jni/../util/neo_err.h:88:69: note: expanded from macro52 'nerr_raise'53 nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)54 ^55 2 errors generated.56 make: *** [out/host/darwin-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] Error 157 external/clearsilver/util/ulist.c:64:12: error: expected expression58 return nerr_raise(NERR_NOMEM, "Unable to create ULIST: Out of memory");59 ^60 external/clearsilver/util/neo_err.h:88:69: note: expanded from macro61 'nerr_raise'62 nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)63 ^64 external/clearsilver/util/ulist.c:70:12: error: expected expression65 return nerr_raise(NERR_NOMEM, "Unable to create ULIST: Out of memory");66 ^67 external/clearsilver/util/neo_err.h:88:69: note: expanded from macro68 'nerr_raise'69 nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)70 ^71 external/clearsilver/util/ulist.c:124:12: error: expected expression72 return nerr_raise(NERR_OUTOFRANGE, "uListPop: empty list");73 ^74 external/clearsilver/util/neo_err.h:88:69: note: expanded from macro75 'nerr_raise'76 nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)77 ^78 3 errors generated.79 make: *** [out/host/darwin-x86/obj/SHARED_LIBRARIES/libneo_util_intermediates/ulist.o] Error 1
以“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:
1 $ sudo mv /usr/bin/cc /usr/bin/cc.bak2 $ sudo mv /usr/bin/c++ /usr/bin/c++.bak3 $ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/cc4 $ 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++。
1 $ sudo rm /usr/bin/cc /usr/bin/c++2 $ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/cc3 $ sudo ln -s /usr/bin/llvm-g++-4.2 /usr/bin/c++
问题解决。