Search code examples
androidlinuxbuildcompiler-errorsmakefile

Android Source Compilation Error


I have followed these steps while working towards building Android:

  1. http://source.android.com/source/initializing.html
  2. http://source.android.com/source/downloading.html
  3. http://source.android.com/source/building.html

Note: I'm running Linux Mint 13 64-bit. (and I'm pretty much a newbie at linux).

I've ran into many problems thus far that I have solved through googling and it is entirely possible I've messed with something I shouldn't have. The problem that I am currently facing and that I am not able to circumvent/solve is the following:

In step three (building), when issuing the command make -j4 I get the following output:

============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=4.0.4.0.4.0.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.2.0-23-generic-x86_64-with-LinuxMint-13-maya
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
OUT_DIR=out
============================================
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1
make: *** Waiting for unfinished jobs....
host Executable: aidl (out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl)
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/EventLogTags.java <= frameworks/base/telephony/java/com/android/internal/telephony/EventLogTags.logtags
/usr/bin/ld: cannot find -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl] Error 1

ps: feel free to ask me for anymore details concerning my environment and I shall provide it, it's just that I'm not sure what else to include and I do not want to make this post to dense to read.

Thanks for any help.

@homer_simpson I think I resolved the missing libz dev package with" "sudo apt-get install zlib1g-dev"

but when I try "sudo apt-get install libstdc++", I get the following output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libstdc++-dev-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.2-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++5' for regex 'libstdc+'
Note, selecting 'libstdc++6' for regex 'libstdc+'
Note, selecting 'libstdc++6-armel-cross-armhf' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.1-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++-dev-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.1-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.2-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++2.9-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-pic' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-armhf-cross-dbg-armel' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.3-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-dev-armel-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.3-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++-dev-armhf-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-doc' for regex 'libstdc+'
Note, selecting 'libstdc++-dev' for regex 'libstdc+'
Note, selecting 'libstdc++2.10-dev' for regex 'libstdc+'
Note, selecting 'libstdc++2.9-glibc2.1-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-dbg-armel-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.2-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.2-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-armhf-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-pic-armel-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-pic' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-dev-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-pic-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++5-3.3-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-dev-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-dev-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-pic-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-dev-armhf-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++5-3.3-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++5-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++5-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-pic-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.3-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.3-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-dev-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.3-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-pic' for regex 'libstdc+'
Note, selecting 'libstdc++5-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.0-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-dev-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.5-pic-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.0-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-dbg-armhf-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-armhf-cross-armel' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-pic-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.0-doc' for regex 'libstdc+'
Note, selecting 'libstdc++2.8-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-pic-armhf-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++5-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.0-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-dev-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++-dev-armel-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++5-3.3-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.1-dbg-armel-cross' for regex 'libstdc+'
Note, selecting 'libstdc++5-3.3-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-pic-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++3.0-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.6-armel-cross-dbg-armhf' for regex 'libstdc+'
Note, selecting 'libstdc++6-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-doc' for regex 'libstdc+'
Note, selecting 'libstdc++6-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.1-dbg-armhf-cross' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-dbg' for regex 'libstdc+'
Note, selecting 'libstdc++6-4.4-dev' for regex 'libstdc+'
Note, selecting 'libstdc++6-armel-dcv1' for regex 'libstdc+'
Note, selecting 'libstdc++6-armel-cross' instead of 'libstdc++6-armel-dcv1'
Note, selecting 'libstdc++6-armhf-cross' instead of 'libstdc++6-armhf-dcv1'
libstdc++6 is already the newest version.
libstdc++6-4.6-dev is already the newest version.
libstdc++6-4.6-dev set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libstdc++6-4.5-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-1ubuntu2 is to be installed
 libstdc++6-4.5-dbg-armel-cross : Conflicts: libstdc++6-4.4-dbg-armel-cross but 4.4.7-1ubuntu2cross1.52 is to be installed
 libstdc++6-4.5-dbg-armhf-cross : Conflicts: libstdc++6-4.4-dbg-armhf-cross but 4.4.7-1ubuntu2cross1.52 is to be installed
 libstdc++6-4.5-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-1ubuntu2 is to be installed
 libstdc++6-4.6-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-1ubuntu2 is to be installed
                      Conflicts: libstdc++6-4.5-dbg but 4.5.3-12ubuntu2 is to be installed
 libstdc++6-4.6-dbg-armel-cross : Conflicts: libstdc++6-4.4-dbg-armel-cross but 4.4.7-1ubuntu2cross1.52 is to be installed
                                  Conflicts: libstdc++6-4.5-dbg-armel-cross but 4.5.3-12ubuntu2cross1.61 is to be installed
 libstdc++6-4.6-dbg-armhf-cross : Conflicts: libstdc++6-4.4-dbg-armhf-cross but 4.4.7-1ubuntu2cross1.52 is to be installed
                                  Conflicts: libstdc++6-4.5-dbg-armhf-cross but 4.5.3-12ubuntu2cross1.61 is to be installed
 libstdc++6-4.6-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-1ubuntu2 is to be installed
                      Conflicts: libstdc++6-4.5-doc but 4.5.3-12ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

Solution

  • I have never build Android on my own. But it looks like you are missing the dev packages for libz and libstdc++ on your linux distribution.