• win10 virtualbox上ubuntu20.04编译android9源码


    1.先请确认ubuntu的版本,不同版本对应不同源,如下ubuntu20.04使用了bionic或者xenial的源,导致编译时存在问题,最后还是换focal源解决的

    2.virtualbox虚拟机如果要在共享目录中编译,比较麻烦,因为软连接的问题,可以修改,或者虚拟机硬盘分大点估计要150G,包括源码包(清华离线包现在有96G(格式pigz又不支持,我当时下载慢以为是网速问题,后来解压慢,当时硬盘读写就不到2M也没注意,忍住了,解压又花了24h,后来删个源码几个文件都要按分钟算,熟不可忍,才用DG扫了下硬盘,结果全是红的,重新插拔了下就好了估计是接触不良,巨坑),而且解压后未必能sync成功,建议还是直接多线程在线同步repo sync -j`nproc`,几个小时的事,不要搞的太复杂)

    ubuntu虚拟硬盘扩容有几篇文章可以自己搜下,很麻烦,我直接重装重新分配的

    3.使用repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-9.0.0_r9 --depth=1 --platform=auto
    视需求是否要下载git日志,不带日志近40G,解压后近40G,删除压缩包后编译,产生大量目标文件占用巨大空间编译到80%已经增加了70G

    所以,耗子尾汁。。。

    更换清华源
    /etc/apt/souces.list

    https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
    
    # 预发布软件源,不建议启用
    # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
    

    mkdir ~/bin
    PATH=~/bin:$PATH

    sudo apt-get install curl

    curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
    chmod a+x ~/bin/repo

    sudo apt-get install python

    git config --global user.email "kuikuitage@163.com"
    git config --global user.name "kuikuitage"

    export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
    repo init --depth=1 -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r51
    repo sync -j`nproc`

    安装openjdk8

    sudo apt-get install -y 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 -y tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
    sudo apt-get install -y dpkg-dev libsdl1.2-dev libesd0-dev
    sudo apt-get install -y git-core gnupg zip curl zlib1g-dev gcc-multilib
    sudo apt-get install -y libc6-dev-i386 x11proto-core-dev libx11-dev
    sudo apt-get install -y unzip m4 lib32z-dev ccache libssl-dev
    sudo apt-get install -y lib32ncurses5-dev

    如有如下相关报错
    将except getopt.GetoptError, e: 改为 except getopt.GetoptError as e:
    print str(err)
    等可能是python版本问题,python3.8会有符号问题,降低版本,卸载3.8版本
    apt-get purge python3.8
    apt-get updates
    apt-get install python

    或者已有旧版本直接改软链接

    python软连接改成旧版本 ln -s /usr/bin/python2.x /usr/bin/python

    apt-get purge python3.8
    apt-get updates
    apt-get install python

    找不到c++报错
    sudo apt-get install build-essential

    libraries报错
    lang.real: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
    sudo apt-get install libncurses5

    source build/envsetup.sh
    lunch 6
    make -j16

    如果遇到有其他问题,请自行google或者baidu

  • 相关阅读:
    UEFI手札
    ARM非对齐访问和Alignment Fault
    PCIE手札
    开始→运行(cmd)命令大全
    关于C#静态构造函数的几点说明
    网址
    python并发编程之多进程理论部分
    第九篇:网络编程
    第八篇:异常处理
    第七篇:面向对象高级
  • 原文地址:https://www.cnblogs.com/kuikuitage/p/14199728.html
Copyright © 2020-2023  润新知