当我在ubuntu16.04上构建android5.0时,出现以下错误:


  外部/ libcxx / include / atomic:539:2:错误:未实现#error
  art / runtime / atomic.h:155:5:错误:“ atomic_thread_fence”不是“ std”的成员
  art / runtime / atomic.h:155:30:错误:“ memory_order_acquire”不是“ std”的成员
  art / runtime / entrypoints / entrypoint_utils.h:50:44:错误:'art :: mirror :: Class * art :: CheckClassInitializedForObjectAlloc(art :: mirror :: Class *,art :: Thread *,bool *)'声明“静态”但从未定义[-Werror = unused-function]
  art / runtime / entrypoints / entrypoint_utils.h:146:33:错误:'art :: mirror :: ArtField * art :: FindFieldFast(uint32_t,art​​ :: mirror :: ArtMethod *,art :: FindFieldType,size_t)'已声明“静态”但从未定义[-Werror = unused-function]
  art / runtime / entrypoints / entrypoint_utils.h:152:34:错误:'art :: mirror :: ArtMethod * art :: FindMethodFast(uint32_t,art​​ :: mirror :: Object *,art :: mirror :: ArtMethod *, bool,art :: InvokeType)'声明为'static',但从未定义[-Werror = unused-function]
  art / runtime / entrypoints / entrypoint_utils.h:158:30:error:'art :: mirror :: Class * art :: ResolveVerifyAndClinit(uint32_t,art​​ :: mirror :: ArtMethod *,art :: Thread *,bool,bool )'声明为“静态”,但从未定义[-Werror = unused-function]
  art / runtime / entrypoints / entrypoint_utils.h:166:31:错误:'art :: mirror :: String * art :: ResolveStringFromCode(art :: mirror :: ArtMethod *,uint32_t)'声明为“静态”,但从未定义[ -Werror =未使用的功能]
  art / runtime / entrypoints / entrypoint_utils.h:171:20:错误:“ void art :: UnlockJniSynchronizedMethod(jobject,art​​ :: Thread *)”声明为“ static”,但从未定义[-Werror = unused-function]
  art / runtime / entrypoints / entrypoint_utils.h:177:20:错误:“ void art :: CheckSuspend(art :: Thread *)”声明为“静态”,但从未定义[-Werror = unused-function]
  cc1plus:所有警告均被视为错误


为什么会出现?

最佳答案

我通过修改$ANDROID_REPO/art/build/Android.common_build.mk解决了这个问题:

-#ART_HOST_CLANG := false
-#ifneq ($(WITHOUT_HOST_CLANG),true)
 - # By default, host builds use clang for better warnings.
 ART_HOST_CLANG := true
-#endif


确保ART_HOST_CLANG = true。然后,我创建了以下符号链接:

ln -sf /usr/bin/ld.gold $ANDROID_REPO/prebuilts/gcc/linux-x86/host/(glibc version)/x86_64-linux/bin/ld


参考:xda-developers forum: how to setup Ubuntu 16.04

关于android - ubuntu16.04 lts build android5.0 Error,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39331581/

10-10 05:52