problems build android-7.0.0_r1 with gcc

1,130 views
Skip to first unread message

Yingchun Li

unread,
Oct 26, 2016, 1:01:12 PM10/26/16
to Android Building
I compiled android-n with gcc, when build bionic/libc/ with the 
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/, the compile errors list as following:

mmma bionic/libc/ -B

FAILED: /bin/bash -c "(PWD=/proc/self/cwd  prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-g++ -I bionic/libc -I bionic/libc/malloc_debug -I out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates -I out/target/product/etau-V2000AN/gen/SHARED_LIBRARIES/libc_malloc_debug_intermediates -I libnativehelper/include/nativehelper \$(cat out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/import_includes) -isystem system/core/include -isystem system/media/audio/include -isystem hardware/libhardware/include -isystem hardware/libhardware_legacy/include -isystem hardware/ril/include -isystem libnativehelper/include -isystem frameworks/native/include -isystem frameworks/native/opengl/include -isystem frameworks/av/include -isystem frameworks/base/include -isystem out/target/product/etau-V2000AN/obj/include -isystem bionic/libc/arch-arm/include -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/common -isystem bionic/libc/kernel/uapi/asm-arm -isystem bionic/libm/include -isystem bionic/libm/include/arm -c  -fno-exceptions -Wno-multichar -msoft-float -ffunction-sections -fdata-sections -funwind-tables -fstack-protector-strong -Wa,--noexecstack -Werror=format-security -D_FORTIFY_SOURCE=2 -fno-short-enums -no-canonical-prefixes -fno-canonical-system-headers -mcpu=cortex-a7 -D__ARM_FEATURE_LPAE=1 -mfloat-abi=softfp -mfpu=neon  -fno-builtin-sin -fno-strict-volatile-bitfields -Wno-psabi -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -fdiagnostics-color -fdebug-prefix-map=/proc/self/cwd= -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point  -DNDEBUG -g -Wstrict-aliasing=2 -fgcse-after-reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG   -fvisibility-inlines-hidden -Wsign-promo  -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing  -fno-rtti -Wall -Werror -fno-stack-protector -Wno-error=format-zero-length -fPIC -D_USING_LIBCXX -std=gnu++11    -MD -MF out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.d -o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.o bionic/libc/malloc_debug/malloc_debug.cpp ) && (cp out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.d out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.P; sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\\\\$//' -e '/^\$/ d' -e 's/\$/ :/' < out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.d >> out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.P; rm -f out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_malloc_debug_intermediates/malloc_debug.d )"
bionic/libc/malloc_debug/malloc_debug.cpp: In function 'void* debug_calloc(size_t, size_t)':
bionic/libc/malloc_debug/malloc_debug.cpp:546:49: error: '__builtin_mul_overflow' was not declared in this scope
   if (__builtin_mul_overflow(nmemb, bytes, &size)) {
                                                 ^
bionic/libc/malloc_debug/malloc_debug.cpp:557:70: error: '__builtin_add_overflow' was not declared in this scope
   if (__builtin_add_overflow(size, g_debug->extra_bytes(), &real_size)) {
                                                                      ^
bionic/libc/malloc_debug/malloc_debug.cpp: In function 'int debug_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*)':
bionic/libc/malloc_debug/malloc_debug.cpp:606:24: error: declaration of 'void (* debug_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*)::iterate_ctx::callback)(uintptr_t, size_t, void*)' [-fpermissive]
     decltype(callback) callback;
                        ^
bionic/libc/malloc_debug/malloc_debug.cpp:602:60: error: changes meaning of 'callback' from 'void (* callback)(uintptr_t, size_t, void*)' [-fpermissive]
     void (*callback)(uintptr_t base, size_t size, void* arg), void* arg) {
                                                            ^
bionic/libc/malloc_debug/malloc_debug.cpp:607:19: error: declaration of 'void* debug_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*)::iterate_ctx::arg' [-fpermissive]
     decltype(arg) arg;
                   ^
bionic/libc/malloc_debug/malloc_debug.cpp:602:69: error: changes meaning of 'arg' from 'void* arg' [-fpermissive]
     void (*callback)(uintptr_t base, size_t size, void* arg), void* arg) {
                                                                     ^
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1

Because __builtin_add_overflow is the new gcc feature after 5.0

So I download a gcc 6.1 from Linaro
other issues happened:

FAILED: /bin/bash -c "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/arm-linux-androideabi-g++ -nostdlib -Wl,-soname,libc.so -Wl,--gc-sections -Wl,-shared  -Lout/target/product/etau-V2000AN/obj/lib    out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/arch-common/bionic/crtbrand.o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/arch-common/bionic/crtend_so.o   out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/bionic/malloc_common.o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/bionic/libc_init_dynamic.o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/bionic/NetdClient.o       out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/arch-common/bionic/crtbegin_so.o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/arch-arm/bionic/exidx_dynamic.o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/arch-arm/bionic/atexit_legacy.o         -Wl,--whole-archive  out/target/product/etau-V2000AN/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a out/target/product/etau-V2000AN/obj/STATIC_LIBRARIES/libjemalloc_intermediates/libjemalloc.a -Wl,--no-whole-archive   out/target/product/etau-V2000AN/obj/STATIC_LIBRARIES/libcompiler_rt-extras_intermediates/libcompiler_rt-extras.a   prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/../lib/gcc/arm-linux-androideabi/6.1.1/../../../../arm-linux-androideabi/lib/libatomic.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/../lib/gcc/arm-linux-androideabi/6.1.1/libgcc.a -ldl  -o out/target/product/etau-V2000AN/obj/SHARED_LIBRARIES/libc_intermediates/LINKED/libc.so  -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,--no-undefined-version -Wl,--no-fix-cortex-a8  -Wl,--hash-style=both -Wl,--version-script,bionic/libc/libc.arm.map  -Wl,--no-undefined"
/home/user/rda-n/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/../lib/gcc/arm-linux-androideabi/6.1.1/../../../../arm-linux-androideabi/bin/ld: error: version script assignment of LIBC_PRIVATE to symbol __divdi3 failed: symbol not defined
/home/user/rda-n/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/../lib/gcc/arm-linux-androideabi/6.1.1/../../../../arm-linux-androideabi/bin/ld: error: version script assignment of LIBC_PRIVATE to symbol __gnu_ldivmod_helper failed: symbol not defined
/home/user/rda-n/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/../lib/gcc/arm-linux-androideabi/6.1.1/../../../../arm-linux-androideabi/bin/ld: error: version script assignment of LIBC_PRIVATE to symbol __gnu_uldivmod_helper failed: symbol not defined
/home/user/rda-n/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-6.1/bin/../lib/gcc/arm-linux-androideabi/6.1.1/../../../../arm-linux-androideabi/bin/ld: error: version script assignment of LIBC_PRIVATE to symbol __udivdi3 failed: symbol not defined
collect2: error: ld returned 1 exit status

Any help will be very appreciated.

Dan Willemsen

unread,
Oct 26, 2016, 1:12:12 PM10/26/16
to Android Building
Try removing `USE_CLANG_PLATFORM_BUILD := false` so that you're building with Clang instead of GCC. All the AOSP devices that I checked are building with Clang by default in android-7.0.0_r1, and the default for that variable if unset was switched to true.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yingchun Li

unread,
Oct 27, 2016, 11:23:37 AM10/27/16
to Android Building
In fact, there is no error with clang, but binaries generated with CLANG is larger than GCC,  so
I want to use GCC compile the whole project.
With no lucky, the bionic libc encounter compile errors firstly(maybe a lot of other modules).
Reply all
Reply to author
Forward
0 new messages