从来源构建 Android:不支持的 reloc 43
Building Android from sources: unsupported reloc 43
当我编译 Android 5.1.1 时,我遇到了很多这样的错误:
...
...
...
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
并且制作过程最终失败:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1
我尝试过使用和不使用 clang 以及不同版本的 clang 构建源代码。但是在较新的分支上,clang 是必需的,没有它 make 就无法启动。
可能出了什么问题?
您是在 Arch Linux 上构建吗?从今天开始我有同样的问题。我之前的构建是 3 天前的,一切都很好。今天都失败了。
我看到管理员在 2 天前升级了一些软件包,尤其是这些
[2016-03-16 15:29] [ALPM] upgraded glibc (2.22-3 -> 2.23-1)
[2016-03-16 15:29] [ALPM] upgraded lib32-glibc (2.22-3.1 -> 2.23-1)
[2016-03-16 15:29] [ALPM] upgraded lib32-gcc-libs (5.3.0-3 -> 5.3.0-5)
[2016-03-16 15:29] [ALPM] upgraded gcc-libs-multilib (5.3.0-3 -> 5.3.0-5)
[2016-03-16 15:29] [ALPM] upgraded libcap (2.24-2 -> 2.25-1)
[2016-03-16 15:29] [ALPM] upgraded binutils (2.25.1-3 -> 2.26-3)
[2016-03-16 15:29] [ALPM] upgraded gcc-multilib (5.3.0-3 -> 5.3.0-5)
[2016-03-16 15:29] [ALPM] upgraded libcups (2.1.2-3 -> 2.1.3-1)
binutils 可能是罪魁祸首? (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808206)
另见https://groups.google.com/d/msg/android-x86/U1XpL0tUpqw/y4W3wRCdJgAJ ...
作为一个艰难的解决方法,我只是在 /usr/bin/ld.gold 上用软 link 替换了预构建的 linker 。
它在这里描述:https://bbs.archlinux.org/viewtopic.php?id=209698 .
应该应用此补丁才能使一切正常工作https://android-review.googlesource.com/#/c/223100/
用一些编辑器打开 android 源代码目录中的 build/core/clang/HOST_x86_common.mk
文件添加这些行,如 link
中所述
对于 Android Lollipop 或任何更早版本,请确保在应用此补丁时保留 -no-integrated-as
。确保行继续是正确的(\
在每行的末尾,除了最后一行)。
但是,-no-integrated-as
在 Marshmallow 中被删除了。
对我有用:
在文件 /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
如果仍然无效,请在您的 android 根路径中尝试此操作:
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
问题来自 binutils 中的不兼容更改:添加了一些部分。一些构建平台有新的 binutils 和 android 构建树有旧的。该错误来自 clang 调用变量定义。这些不会告诉 clang 使用提供的构建链。然后 clang 使用本机构建平台 binutils(这里 /usr/bin/as 而不是提供的预构建)。然后修复意味着应用 mysticTot 指向的补丁,然后删除工具链生成的所有二进制文件(根据错误出现的位置,这可能会改变,但删除树中的所有 STATIC_LIBRARIES/SHARED_LIBRARIES/EXECUTABLES 等目录应该这样做)。同时删除 ccache 缓存(因为它存储 .o)然后重建。
Ov3r1oad 提供的修复包括用本机 ld 替换预构建工具链 ld 不是解决方案,只是一种解决方法并且可能很危险(混合部分编号不好)。
希望对你有帮助。
当我编译 Android 5.1.1 时,我遇到了很多这样的错误:
...
...
...
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
并且制作过程最终失败:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1
我尝试过使用和不使用 clang 以及不同版本的 clang 构建源代码。但是在较新的分支上,clang 是必需的,没有它 make 就无法启动。
可能出了什么问题?
您是在 Arch Linux 上构建吗?从今天开始我有同样的问题。我之前的构建是 3 天前的,一切都很好。今天都失败了。
我看到管理员在 2 天前升级了一些软件包,尤其是这些
[2016-03-16 15:29] [ALPM] upgraded glibc (2.22-3 -> 2.23-1)
[2016-03-16 15:29] [ALPM] upgraded lib32-glibc (2.22-3.1 -> 2.23-1)
[2016-03-16 15:29] [ALPM] upgraded lib32-gcc-libs (5.3.0-3 -> 5.3.0-5)
[2016-03-16 15:29] [ALPM] upgraded gcc-libs-multilib (5.3.0-3 -> 5.3.0-5)
[2016-03-16 15:29] [ALPM] upgraded libcap (2.24-2 -> 2.25-1)
[2016-03-16 15:29] [ALPM] upgraded binutils (2.25.1-3 -> 2.26-3)
[2016-03-16 15:29] [ALPM] upgraded gcc-multilib (5.3.0-3 -> 5.3.0-5)
[2016-03-16 15:29] [ALPM] upgraded libcups (2.1.2-3 -> 2.1.3-1)
binutils 可能是罪魁祸首? (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808206)
另见https://groups.google.com/d/msg/android-x86/U1XpL0tUpqw/y4W3wRCdJgAJ ...
作为一个艰难的解决方法,我只是在 /usr/bin/ld.gold 上用软 link 替换了预构建的 linker 。 它在这里描述:https://bbs.archlinux.org/viewtopic.php?id=209698 .
应该应用此补丁才能使一切正常工作https://android-review.googlesource.com/#/c/223100/
用一些编辑器打开 android 源代码目录中的 build/core/clang/HOST_x86_common.mk
文件添加这些行,如 link
对于 Android Lollipop 或任何更早版本,请确保在应用此补丁时保留 -no-integrated-as
。确保行继续是正确的(\
在每行的末尾,除了最后一行)。
但是,-no-integrated-as
在 Marshmallow 中被删除了。
对我有用:
在文件 /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
如果仍然无效,请在您的 android 根路径中尝试此操作:
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
问题来自 binutils 中的不兼容更改:添加了一些部分。一些构建平台有新的 binutils 和 android 构建树有旧的。该错误来自 clang 调用变量定义。这些不会告诉 clang 使用提供的构建链。然后 clang 使用本机构建平台 binutils(这里 /usr/bin/as 而不是提供的预构建)。然后修复意味着应用 mysticTot 指向的补丁,然后删除工具链生成的所有二进制文件(根据错误出现的位置,这可能会改变,但删除树中的所有 STATIC_LIBRARIES/SHARED_LIBRARIES/EXECUTABLES 等目录应该这样做)。同时删除 ccache 缓存(因为它存储 .o)然后重建。 Ov3r1oad 提供的修复包括用本机 ld 替换预构建工具链 ld 不是解决方案,只是一种解决方法并且可能很危险(混合部分编号不好)。 希望对你有帮助。