Ubuntu16 编译源码出错 unsupported reloc 43

 

 

错误如下

复制代码
复制代码
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/bits/basic_string.h:270: error: unsupported reloc 43
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/bits/basic_string.h:270: error: unsupported reloc 43
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/bits/basic_string.h:235: error: unsupported reloc 43
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/bits/basic_string.h:235: error: unsupported reloc 43
libnativehelper/JNIHelp.cpp:310: error: unsupported reloc 43
libnativehelper/JNIHelp.cpp:311: error: unsupported reloc 43
libnativehelper/JNIHelp.cpp:332: error: unsupported reloc 43
libnativehelper/JNIHelp.cpp:322: error: unsupported reloc 43
libnativehelper/JNIHelp.cpp:338: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:89: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:90: error: unsupported reloc 43
复制代码
复制代码

 

解决方法(一)

修改 build/core/clang/HOST_x86_common.mk

复制代码
复制代码
diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk
index 0241cb6..77547b7 100644
--- a/core/clang/HOST_x86_common.mk
+++ b/core/clang/HOST_x86_common.mk
@@ -8,6 +8,7 @@ ifeq ($(HOST_OS),linux)
 CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \
   --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
   --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+  -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
   -no-integrated-as
 
 CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \  
复制代码
复制代码

 但是对我而言 错误仍在

 

解决方法(二)

修改 art/build/Android.common_build.mk

复制代码
复制代码
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
  # By default, host builds use clang for better warnings.
  ART_HOST_CLANG := true
endif
复制代码
复制代码

改为

复制代码
复制代码
# Host.
ART_HOST_CLANG := false
ifeq ($(WITHOUT_HOST_CLANG),false)
  # By default, host builds use clang for better warnings.
  ART_HOST_CLANG := true
endif
复制代码
复制代码

仍然不起作用

 

解决方法(三)

cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/x86_64-linux/bin/ld

这个之后,编译通过。

 

https://www.cnblogs.com/blowing-in-the-wind/p/6518076.html

 

#####################################################################################################################3

Tried @ShawnMilo 's workaround:

v8worker# find . -name ld.gold
./v8/third_party/binutils/Linux_x64/Release/bin/ld.gold

v8worker# mv ./v8/third_party/binutils/Linux_x64/Release/bin/ld.gold ./v8/third_party/binutils/Linux_x64/Release/bin/ld.gold.backup

v8worker# ln -s /usr/bin/ld.gold ./v8/third_party/binutils/Linux_x64/Release/bin/ld.gold


https://github.com/ry/v8worker/issues/41


#################################################################################################################################

unsupported reloc 42 编译错误处理

  1. out/host/linux-x86/obj/SHARED_LIBRARIES/libart_intermediates/arch/x86_64/quick_entrypoints_x86_64.o:function art_quick_deoptimize:
  2. error: unsupported reloc 42
  3. clang: error: linker command failed with exit code 1 (use -v to see invocation)

1、将prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld 备份

 mv prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld.bak

2、使用soft link,链接到全局ld

 ln -s /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld

查看:

  1. zyf@zyf-HP-Pavilion-m4-Notebook-PC:~/work/6580pet/MTK6580_M_V2.34_base_pet$ ls -l prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld
  2. lrwxrwxrwx 1 zyf zyf 16 3月 17 18:17 prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld -> /usr/bin/ld.gold
     
     
     
    https://blog.csdn.net/zyfzhangyafei/article/details/88623503


posted @   a318013800  阅读(934)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
历史上的今天:
2019-11-28 Install the Flash plug-in
2019-11-28 sudo apt -y upgrade
2019-11-28 Linux安装Flash player
2019-11-28 关于Ubuntu中Could not get lock /var/lib/dpkg/lock解决方案
2018-11-28 无损音乐
2018-11-28 realm doc AAAAA
2018-11-28 在子线程中new Handler报错--Can't create handler inside thread that has not called Looper.prepare() AAAAA
点击右上角即可分享
微信分享提示