从源代码构建Android 5.1.1 - 编译错误

时间:2016-08-10 19:14:39

标签: android ubuntu android-source

我正在尝试在运行Ubuntu 16.04的Intel i5机器上从源代码构建Android 5.1.1_r38。

我已经为Nexus 6添加了二进制文件,并在终端中执行“午餐”后选择了该选项。

运行约一小时后,如果给我以下错误

    external/chromium_org/third_party/yasm/source/patched-yasm/tools/genmacro/genmacro.c:90: error: unsupported reloc 43

    external/chromium_org/third_party/yasm/source/patched-yasm/tools/genmacro/genmacro.c:48: error: unsupported reloc 43

    external/chromium_org/third_party/yasm/source/patched-yasm/tools/genmacro/genmacro.c:55: error: unsupported reloc 43

    external/chromium_org/third_party/yasm/source/patched-yasm/tools/genmacro/genmacro.c:68: error: unsupported reloc 43

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    build/core/host_executable_internal.mk:31: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmacro_x86_host_gyp_intermediates/genmacro' failed

    make: *** [out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmacro_x86_host_gyp_intermediates/genmacro] Error 1

    make: *** Waiting for unfinished jobs....

    prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmodule_x86_host_gyp_intermediates/third_party/yasm/source/patched-yasm/libyasm/genmodule.o: unsupported reloc 43 against global symbol stderr

    prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmodule_x86_host_gyp_intermediates/third_party/yasm/source/patched-yasm/libyasm/genmodule.o: unsupported reloc 43 against global symbol stderr

    prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmodule_x86_host_gyp_intermediates/third_party/yasm/source/patched-yasm/libyasm/genmodule.o: unsupported reloc 43 against global symbol stderr

    prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmodule_x86_host_gyp_intermediates/third_party/yasm/source/patched-yasm/libyasm/genmodule.o: unsupported reloc 43 against global symbol stderr

    external/chromium_org/third_party/yasm/source/patched-yasm/libyasm/genmodule.c:87: error: unsupported reloc 43

    external/chromium_org/third_party/yasm/source/patched-yasm/libyasm/genmodule.c:63: error: unsupported reloc 43

    external/chromium_org/third_party/yasm/source/patched-yasm/libyasm/genmodule.c:174: error: unsupported reloc 43

    external/chromium_org/third_party/yasm/source/patched-yasm/libyasm/genmodule.c:183: error: unsupported reloc 43

    host StaticLib: third_party_yasm_genperf_libs_x86_host_gyp_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/third_party_yasm_genperf_libs_x86_host_gyp_intermediates/third_party_yasm_genperf_libs_x86_host_gyp.a)

    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    build/core/host_executable_internal.mk:31: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmodule_x86_host_gyp_intermediates/genmodule' failed


    make: *** [out/host/linux-x86/obj32/EXECUTABLES/third_party_yasm_genmodule_x86_host_gyp_intermediates/genmodule] Error 1

我已经运行apt-get update并制作了clobber以及我能想到的任何其他内容(注意:我对ubuntu很新)

2 个答案:

答案 0 :(得分:1)

尝试应用以下更改:

WORKING_DIRECTORY$ repo diff
project build/
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 := \

另见: https://groups.google.com/forum/#!topic/android-building/op5ZbyEfakE

答案 1 :(得分:0)

我修改Host_x86_common.mk,但问题仍然存在。

最后,我修改art / build/Android.common_build.mk,如下所示:

# Clang build support.

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

幸运的是,这有助于我解决错误。

我使用的提示来自15th floor