When I\'m compiling Android 5.1.1, I get dozens of errors like this:
...
...
...
libnativehelper/JniInvocation.cpp:1
As a hard workaround I just replaced prebuilt linker with soft link on /usr/bin/ld.gold . It described here: https://bbs.archlinux.org/viewtopic.php?id=209698 .
Problems comes from an incompatible change in binutils: some section were added. Some build platform have the new binutils and android build tree have old one. The bug comes from clang invocation variables definition. These doesn't tell clang to use the provided build chain. Then clang uses the native build platform binutils (here /usr/bin/as instead the prebuilts provided as). Then the fix imply applying the patch pointed by mysticTot and then removing all binaries produced by the toolchain (according to where the error appears this could change but removing all STATIC_LIBRARIES/SHARED_LIBRARIES/EXECUTABLES etc dirs in out tree should do it). Also remove the ccache cache (as it stores .o) then rebuild. Fix provided by Ov3r1oad consisting in replacing the prebuilt toolchain ld by the native ld is not a solution, just a workaround and could be dangerous (mixing section number is not good). Hope it willl help.
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
Are you building on Arch Linux? I have the same problem since today. My previous builds were 3 days ago and were all fine. Today all fail.
I see the admin upgraded some packages 2 days ago, especially these
[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 could be the culprit? (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808206)
also see https://groups.google.com/d/msg/android-x86/U1XpL0tUpqw/y4W3wRCdJgAJ ...