编译总结,04编译运行Android

2019-11-27 05:41 来源:未知

1. 系统:buntu 10.04 64位

在Ubuntu 11.04(64位)编译Android2.3源码时,遇到各种各样的问题。不是缺这个,就是少那个。现把这些问题和解决方法罗列出来,供大家参考,本人使用的是Ubuntu 11.04(64位)个人版本,非服务器版本。

首先,本文参考了两个文档(自己动手编译Android源码(超详细)和Ubuntu解决包依赖关系),感谢两位作者

 

错误:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

编译平台:

2.安装好 eclipse 和 JDK 1.5  之后编译 android 2.2 froyo 

make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1

16.04LTS 64bit

 

解决:
sudo apt-get install libc6-dev-i386

编译时遇到的问题:

3.安装前最好check官网的环境准备 。

错误:
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] error 1

PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=7.1.1 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_ARCH=arm64 TARGET_ARCH_VARIANT=armv8-a TARGET_CPU_VARIANT=generic TARGET_2ND_ARCH=arm TARGET_2ND_ARCH_VARIANT=armv7-a-neon TARGET_2ND_CPU_VARIANT=cortex-a15 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-4.8.0-39-generic-x86_64-with-Ubuntu-16.04-xenial HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=NYC OUT_DIR=out ============================================" [ 96% 25/26] glob external/*/Android.bp [ 0% 1/46910] build out/target/product/generic_arm64/obj/ETC/file_contexts.bin_intermediates/file_contexts.local.tmp FAILED: out/target/product/generic_arm64/obj/ETC/file_contexts.bin_intermediates/file_contexts.local.tmp /bin/bash -c "m4 -s system/sepolicy/private/file_contexts out/target/product/generic_arm64/obj/ETC/sectxfile_nl_intermediates/sectxfile_nl > out/target/product/generic_arm64/obj/ETC/file_contexts.bin_intermediates/file_contexts.local.tmp" /bin/bash: m4: command not found [ 0% 2/46910] build out/target/product/generic_arm64/obj/ETC/file_contexts.bin_intermediates/file_contexts.device.tmp FAILED: out/target/product/generic_arm64/obj/ETC/file_contexts.bin_intermediates/file_contexts.device.tmp /bin/bash -c "m4 -s system/sepolicy/vendor/file_contexts out/target/product/generic_arm64/obj/ETC/sectxfile_nl_intermediates/sectxfile_nl build/target/board/generic/sepolicy/file_contexts > out/target/product/generic_arm64/obj/ETC/file_contexts.bin_intermediates/file_contexts.device.tmp" /bin/bash: m4: command not found [ 0% 3/46910] Target buildinfo: out/target/product/generic_arm64/obj/ETC/system_build_prop_intermediates/build.prop Target buildinfo from: build/target/board/generic_arm64/system.prop [ 0% 4/46910] target StaticLib: libtrunks_test (out/target/product/gen...m64/obj/STATIC_LIBRARIES/libtrunks_test_intermediate#! bin/sh sudo apt-get install aptitude sudo aptitude install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib sudo aptitude install -y git flex bison gperf build-essential libncurses5-dev:i386 sudo aptitude install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 sudo aptitude install dpkg-dev libsdl1.2-dev libesd0-dev sudo aptitude install git-core gnupg flex bison gperf build-essential sudo aptitude install zip curl zlib1g-dev gcc-multilib g++-multilib sudo aptitude install libc6-dev-i386 sudo aptitude install lib32ncurses5-dev x11proto-core-dev libx11-dev sudo aptitude install libgl1-mesa-dev libxml2-utils xsltproc unzip m4 sudo aptitude install lib32z-dev ccache #! bin/sh sudo apt-get install aptitude sudo aptitude install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib sudo aptitude install -y git flex bison gperf build-essential libncurses5-dev:i386 sudo aptitude install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 sudo aptitude install dpkg-dev libsdl1.2-dev libesd0-dev sudo aptitude install git-core gnupg flex bison gperf build-essential sudo aptitude install zip curl zlib1g-dev gcc-multilib g++-multilib sudo aptitude install libc6-dev-i386 sudo aptitude install lib32ncurses5-dev x11proto-core-dev libx11-dev sudo aptitude install libgl1-mesa-dev libxml2-utils xsltproc unzip m4 sudo aptitude install lib32z-dev ccache s/libtrunks_test.a ninja: build stopped: subcommand failed. 20:38:09 ninja failed with: exit status 1 build/core/main.mk:24: recipe for target 'run_soong_ui' failed make: *** [run_soong_ui] Error 1 #### make failed to build some targets (28:58 (mm:ss)) ####

      

解决:
  sudo apt-get install g++-multilib

解决方法:执行下面的脚本即可:

比较重要的是如下一步: 

错误:
external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] Error 1

#! bin/sh sudo apt-get install aptitude sudo aptitude install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib sudo aptitude install -y git flex bison gperf build-essential libncurses5-dev:i386 sudo aptitude install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 sudo aptitude install dpkg-dev libsdl1.2-dev libesd0-dev sudo aptitude install git-core gnupg flex bison gperf build-essential sudo aptitude install zip curl zlib1g-dev gcc-multilib g++-multilib sudo aptitude install libc6-dev-i386 sudo aptitude install lib32ncurses5-dev x11proto-core-dev libx11-dev sudo aptitude install libgl1-mesa-dev libxml2-utils xsltproc unzip m4 sudo aptitude install lib32z-dev ccache

Installing required packages (Ubuntu 10.04 -- 11.10)

解决:
sudo apt-get install zlib1g-dev

也就是使用aptitude工具进行安装需要的依赖包!

#########################

错误:
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1

 sudo apt-get install git-core gnupg flex bison gperf build-essential

解决:
sudo apt-get install lib32z1-dev

  zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs

错误:
bison -d -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127

  x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

解决:
sudo apt-get install bison

  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown

错误:
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/bin/bash: flex: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

  libxml2-utils xsltproc

解决:
sudo apt-get install flex

#########################

错误:
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

 

解决:
sudo apt-get install lib32ncurses5-dev

4. 环境配置好后

错误:
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/Android/main-common.o] Error 1

进入froyo目录 

解决:
sudo apt-get install libx11-dev

TAG标签:
版权声明:本文由金沙澳门官网4166发布于世界史,转载请注明出处:编译总结,04编译运行Android