How to fix problem of incompatibility between GCC 4.6 and Android 2.3 (Gingerbread)

Posted: May 27, 2011 in Android, Ubuntu
Tags: , ,

Hello everybody. Let’s see how we can fix one problem that can happen when you try to compile the Android 2.3 after you already have installed GCC 4.6.

During Android compilation you can receive the following error message:

host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
host SharedLib: libneo_cs (out/host/linux-x86/obj/lib/libneo_cs.so)
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
make: *** Waiting for unfinished jobs....

To fix that, open a terminal and run (assuming you are in the folder android):

gedit frameworks/base/libs/utils/Android.mk

Change the line:

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)

To:

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

After that, save the file and recompile the Android again.

That’s it. See you next time.

Advertisements
Comments
  1. kureikain says:

    This is excellent!!!
    Thank and thank a lot.
    You are the man.!

  2. Chris says:

    Was really surprised when I got this error after updating to 2.3.7r1. Appreciate you referencing it on your site for the rest of us. Thanks again!

  3. lwing says:

    Thanks a lot! You’re a life saver 🙂

  4. recluze says:

    Thanks a lot for the quick tip. Had the same problem (with a different error message) on 2.3.7_r1 make. This fixed it.

  5. Thanks a lot, it really works.

  6. kanupatar says:

    Great man.Now it started building correctly.I am trying to build the android gingerbread source in my latest ubuntu 11.10 machine.

    /rg

  7. Aubino says:

    Hello Boys. please escuse myself for posting my problem here! it is a friend of my who recommended it to me.

    i ‘m trying to install Android Hardware Development Environment (HDE)
    into a fresh copy of Ubuntu Linux 10.04.
    I hav sun-java5-jdke already install the sun-java5-jdk and I have extract the HDE project tarball to my desktop by entering the command:
    $ tar -x -f android-hde-ambrosia-2.1_r1.tar.gz -C ~/Desktop

    Now for the next step, I want to build the OS framework and install the ARM 3D graphics SDK.
    So I enter:

    $ cd ~/Desktop/android-hde-ambrosia-2.1_r1.tar
    $ make TARGET_PRODUCT=beagleboard TARGET_VARIANT=tests

    And I obtain this:

    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=2.1-update1
    TARGET_PRODUCT=beagleboard
    TARGET_BUILD_VARIANT=eng
    TARGET_SIMULATOR=
    TARGET_BUILD_TYPE=release
    TARGET_ARCH=arm
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=ECLAIR
    ============================================
    /bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc: No such file or directory
    /bin/bash: line 0: cd: sdk/layoutopt/app/src/resources: No such file or directory
    build/core/Makefile:17: warning: overriding commands for target `out/target/product/beagleboard/system/usr/keylayout/qwerty.kl’
    sdk/emulator/keymaps/Android.mk:13: warning: ignoring old commands for target `out/target/product/beagleboard/system/usr/keylayout/qwerty.kl’
    host C: acp <= build/tools/acp/acp.c
    In file included from /usr/include/features.h:378,
    from /usr/include/stdlib.h:25,
    from build/tools/acp/acp.c:11:
    /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
    make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1

    I am a beginner .
    please, could someone help me to solve this?

    Thanks!!

    Aubino

  8. Klas says:

    Thank you!

  9. shubham says:

    hi,

    thanks for your support,

    but I stl getting following error log.
    pls let me know where I am doing mistake or missing something.

    “Fake: out/target/product/blaze/obj/FAKE/validate_framework_keymaps_intermediates/validate_framework_keymaps-timestamp
    rm -f out/target/product/blaze/obj/STATIC_LIBRARIES/libedify_intermediates/parser.hpp
    Generated: (out/target/product/blaze/android-info.txt)
    Notice file: external/bzip2/NOTICE — out/host/linux-x86/obj/NOTICE_FILES/src//lib/libbz.a.txt
    host Java: guavalib (out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/classes)
    host C: acp <= build/tools/acp/acp.c
    cc: error: -include: No such file or directory
    make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1
    make: *** Waiting for unfinished jobs….
    host C++: libhost <= build/libs/host/pseudolocalize.cpp
    g++: error: -include: No such file or directory
    make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o] Error 1
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details."

    thanks

  10. cschooley says:

    Thanks dude. This did it.

  11. thank you, building 2.2.3 and this came up, very useful

  12. BlackGhost says:

    thanks a lot!

  13. Joebob says:

    Helped me. Thank you sir!

  14. Piyush says:

    Thank you so much! This helped. 🙂

  15. Kent Borg says:

    Thanks.

    I was grepping around for a place to put an “-fpermissive” when I decided to Google for it, and it found your posting. Cool. My build is chugging along way part that error.

    These internets are going to be famous someday.

  16. […] Outro problema é o de compilação. Este problema foi encontrado por outras pessoas. A melhor resposta encontra-se neste link. […]

  17. Jamy says:

    You save me…thank you

  18. […] How to fix problem of incompatibility between GCC 4.6 and Android 2.3 (Gingerbread) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s