Android源码编译

1.源码下载。

     使用清华的镜像https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

     参考https://blog.csdn.net/hunter___/article/details/80972878

     设置变量GIT_CURL_VERBOSE可以看到详细的出错情况:

      #export GIT_CURL_VERBOSE=1

      repo init --depth 1 -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-10.0.0_r36


(1)unubtu 安装依赖

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

//如果提示libncurses.so.5: cannot open shared object file: No such file or directory

https://blog.csdn.net/weixin_34060741/article/details/88000554

安装libncurses5

1.sudo apt install apt-file 

2.sudo apt-file update

3.sudo apt-file find libncurses.so.5

4.sudo apt install libncurses5

(2)升级python

Centos7下python2.7升级至3.6

安装依赖

yum -y install zlib

yum -y install zlib-devel

yum install glibc.i686

提示 

ModuleNotFoundError: No module named '_ssl'

https://www.jb51.net/article/160435.htm

yum install deltarpm

yum install openssl-devel -y

https://blog.csdn.net/u011798443/article/details/80825817

cd/usr/local/src

wgethttps://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz

服务器版本: centos7

旧python版本:2.7.5

新python版本:3.6.3

接下来正式开始:

从Python官网到获取Python3的包, 切换到目录/usr/local/src

执行命令行: wgethttps://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz

使用命令,如下命令进行解压缩:

tar -xzf Python3.6.3.tgz

在/usr/local路径下创建目录--python3

mkdir /usr/local/python3

编译安装

A. 执行命令: cd /usr/local/src/Python-3.6.3

B. 执行命令: ./configure --prefix=/usr/local/python3

C. 执行命令: make all

D. 执行命令: make install

进入安装的绝对路径,检查是否安装成功

执行命令: /usr/local/python3/bin/python3.6 -V

查看环境变量,启动python时默认按照PATH的顺序进行查找。

执行命令: echo $PATH

修改软连接,启动python时指向python3.6

A.备份之前的python

执行命令: mv /usr/bin/python /usr/bin/python2.7.5 (请先查询好自己的python版本)

B.修改软连接

使用python3

执行命令:

ln -s /usr/local/python3/bin/python3 /usr/bin/python

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

使用python2

ln -s python2.7 /usr/bin/python

ls -l| grep python

lrwxrwxrwx 1 root root 30 May 27 16:09 python -> /usr/local/python3/bin/python3

lrwxrwxrwx. 1 root root 9 Dec 30 19:00 python2 -> python2.7

-rwxr-xr-x. 1 root root 7216 Aug 7 2019 python2.7

lrwxrwxrwx. 1 root root 7 Dec 30 19:00 python2.7.5 -> python2

lrwxrwxrwx 1 root root 30 Jun 7 18:37 python3 -> /usr/local/python3/bin/python3

C.查看python版本:

执行命令: python

修改yum文件,因为升级了版本以后,yum就会报错:

执行命令:sudo vim /usr/bin/yum

在第一行的后面跟上旧的版本号!

执行命令: sudo vim /usr/libexec/urlgrabber-ext-down

在文件的第一行,也改为 python2.7 (2.7是版本,自己根据自己的版本改!)

(3)centos安装依赖

  yum -y install m4

安装jdk

yum search java | grep -i --color JDK

yum install java-1.8.0-openjdk-devel.x86_64

//android 9升级GLIBC_2.18

https://www.jianshu.com/p/5bb21028cde1

yum install libstdc++.i686

yum install zip

yum install patch

3.编译

source build/envsetup.sh

lunch

make -j24

source build/envsetup.sh

你可能感兴趣的:(Android源码编译)