prebuilts/misc/darwin-x86/bison/bison: Bad CPU type in executable

方案一

cd external/bison
touch patch-high-sierra.patch
vim patch-high-sierra.patch
With format string strictness, High Sierra also enforces that %n isn't used
in dynamic format strings, but we should just disable its use on darwin in
general.
 
--- lib/vasnprintf.c.orig   2017-06-22 15:19:15.000000000 -0700
+++ lib/vasnprintf.c    2017-06-22 15:20:20.000000000 -0700
@@ -4869,7 +4869,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
 #endif
                   *fbp = dp->conversion;
 #if USE_SNPRINTF
-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
                 fbp[1] = '%';
                 fbp[2] = 'n';
                 fbp[3] = '\0';

patch -p0 < patch-high-sierra.patch  
mm
cp ./out/host/darwin-x86/obj/EXECUTABLES/bison_intermediates/bison ./prebuilts/misc/darwin-x86/bison/bison 

情形2

编译报错可能会遇到dexdump2和dex2oat被编译成32bit的,导致报错为bad cpu这个错误

art/build/Android.common.mk ,他这个地方有一个判断,看注释mac os不支持最低4g内存申请在64位进程中。

ifneq ($(HOST_OS),darwin)
  ART_HOST_SUPPORTED_ARCH := x86 x86_64
else
  # Mac OS doesn't support low-4GB allocation in a 64-bit process. So we won't be able to create
  # our heaps.
  ART_HOST_SUPPORTED_ARCH := x86_64
  ART_MULTILIB_OVERRIDE_host := 64
endif

情景三

  1. Pre-compiled bison tool issues

    make: prebuilts/misc/darwin-x86/bison/bison: Bad CPU type in executable make: *** [out/host/darwin-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 1 make: *** Waiting for unfinished jobs...


    Solution:
    Replace the bison with our system through a soft link

    rm prebuilts/misc/darwin-x86/bison/bison

     

    jiangshenghuadeMacBook-Pro:firefly_rk3288_adnroid5.1 jshh$ which bison

     

    /usr/bin/bison

     

    ln -s /usr/bin/bison prebuilts/misc/darwin-x86/bison/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值