在ubuntu16.04系统编译源码aosp

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

编译平台:

16.04LTS 64bit

编译时遇到的问题:

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)) ####

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

#! 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

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

你可能感兴趣的:(在ubuntu16.04系统编译源码aosp)