Building Android from sources: unsupported reloc 43

Christian Rädel picture Christian Rädel · Mar 16, 2016 · Viewed 18.8k times · Source

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?

Answer

Zzz0_o picture Zzz0_o · May 27, 2016

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.