欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

ubuntu 18.04编译android 源码及问题排错

程序员文章站 2022-03-18 10:52:59
/bin/bash: m4: command not found[ 12% 12196/98404] Check module type: out/host/linux-x86/obj/STATIC_LIBRARIES/libsepol_intermediates/link_type[ 12% 12197/98404] Export includes file: -- out/host/linux-x86/obj/EXECUTABLES/sepolicy-analyze_intermediates/e....

 

编译源码

1、安装 openjdk8

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

2  如果电脑里面存在多个java 版本,则通过如下命令选择openjdk-8即可

sudo update-alternative --config java
sudo update-alternative --config javac

2、安装依赖库

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

3、开始编译


/bin/bash: m4: command not found
[ 12% 12196/98404] Check module type: out/host/linux-x86/obj/STATIC_LIBRARIES/libsepol_intermediates/link_type
[ 12% 12197/98404] Export includes file:  -- out/host/linux-x86/obj/EXECUTABLES/sepolicy-analyze_intermediates/export_includes
[ 12% 12198/98404] Import includes file: out/host/linux-x86/obj/EXECUTABLES/sepolicy-analyze_intermediates/import_includes
[ 12% 12199/98404] build out/target/product/sp7731e_1h10/sp7731e-1h10-native.dtb
[ 12% 12200/98404] Notice file: system/sepolicy/NOTICE -- out/target/product/sp7731e_1h10/obj/NOTICE_FILES/src/recovery/root/sepolicy.txt
[ 12% 12201/98404] target StaticLib: libsprd_updater (out/target/product/sp7731e_1h10/obj/STATIC_LIBRARIES/libsprd_updater_intermediates/libsprd_updater.a)
[ 12% 12202/98404] Copy: out/target/product/sp7731e_1h10/kernel
ninja: build stopped: subcommand failed.
FAILED: [W][2020-11-11T18:19:35+0800][2358] void cmdline::logParams(nsjconf_t *)():250 Process will be UID/EUID=0 in the global user namespace, and will have user root-level access to files
[W][2020-11-11T18:19:35+0800][2358] void cmdline::logParams(nsjconf_t *)():260 Process will be GID/EGID=0 in the global user namespace, and will have group root-level access to files
18:19:47 ninja failed with: exit status 1

 

遇见这个最后的报错的时候,注意向上看看base输出。
这就是问题所在,比如我的:/bin/bash: m4: command not found
然后  下载这个指令就可以了:sudo apt-get install m4
然后重新make,继续执行就可以了。


(3)FAILED: out/target/product/fugu/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp
/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/target/product/fugu/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp bootable/recovery/edify/lexer.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
Aborted (core dumped)
[  6% 3452/56388] //frameworks/base/libs/androidfw:libandroidfw clang++ ResourceTypes.cpp [linux]
ninja: build stopped: subcommand failed.
09:56:41 ninja failed with: exit status 1

去除所有本地化的设置,让命令能正确执行,bash 执行:

export LC_ALL=C

export LC_ALL=C
to your .bashrc file under your home folder


4)error: ro.build.fingerprint cannot exceed 91 bytes
更改 build/tools/post_process_props.py 文件行 PROP_VALUE_MAX = 91 为 PROP_VALUE_MAX = 128

    #### PROP_VALUE_MAX = 91
    PROP_VALUE_MAX = 128
更改 bionic/libc/include/sys/system_properties.h 文件行 #define PROP_VALUE_MAX  91 为 #define PROP_VALUE_MAX  128
    #### #define PROP_VALUE_MAX  91
    #define PROP_VALUE_MAX  128
更改 frameworks/native/cmds/installd/installd_deps.h 文件行 constexpr size_t kPropertyValueMax = 91u; 为 constexpr size_t kPropertyValueMax = 128u;
    #### constexpr size_t kPropertyValueMax = 91u;
    constexpr size_t kPropertyValueMax = 128u;


本文地址:https://blog.csdn.net/nei504293736/article/details/109628378