When I'm compiling Android 5.1.1, I get dozens of errors like this:
... ... ... 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
and the make process finally fails:
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
I've tried building sources with and without clang, and with different versions of clang. But on newer branches, clang is a requirement and make doesn't start without it.
What might be wrong?
One should apply this patch to get the things working https://android-review.googlesource.com/#/c/223100/
Open build/core/clang/HOST_x86_common.mk
file in your android source code directory with some editor add these lines, as mentioned in this link
For Android Lollipop or any earlier version, make sure to keep -no-integrated-as
while applying this patch. Make sure the line continuations are proper(\
at the end of each line except the last line).
But, -no-integrated-as
is removed in Marshmallow.
It works to me:
in file /art/build/Android.common_build.mk, find out:
# Host. ART_HOST_CLANG := false ifneq ($(WITHOUT_HOST_CLANG),true) # By default, host builds use clang for better warnings. ART_HOST_CLANG := true endif
change to :
# Host. ART_HOST_CLANG := false ifeq ($(WITHOUT_HOST_CLANG),false) # By default, host builds use clang for better warnings. ART_HOST_CLANG := true endif
If it still not works,try this in your android root path: cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With