未验证 提交 1f9a75a1 编写于 作者: G guofei 提交者: GitHub

Refine source_compile.md (#2269)

* Refine source_compile.md

* Refine source_compile.md

test=develop

* Refine source_compile.md

test=develop
上级 ed3dd608
...@@ -77,14 +77,16 @@ docker rm <container-name> ...@@ -77,14 +77,16 @@ docker rm <container-name>
### 2、Linux 开发环境 ### 2、Linux 开发环境
#### 交叉编译环境要求 #### Android
##### 交叉编译环境要求
- gcc、g++、git、make、wget、python、adb - gcc、g++、git、make、wget、python、adb
- Java environment - Java environment
- cmake(建议使用3.10或以上版本) - cmake(建议使用3.10或以上版本)
- Android NDK (建议ndk-r17c) - Android NDK (建议ndk-r17c)
#### 具体步骤 ##### 具体步骤
安装软件部分以 Ubuntu 为例,其他 Linux 发行版类似。 安装软件部分以 Ubuntu 为例,其他 Linux 发行版类似。
...@@ -116,6 +118,69 @@ echo "export NDK_ROOT=/opt/android-ndk-r17c" >> ~/.bashrc ...@@ -116,6 +118,69 @@ echo "export NDK_ROOT=/opt/android-ndk-r17c" >> ~/.bashrc
source ~/.bashrc source ~/.bashrc
``` ```
#### ARM Linux
适用于基于 ARMv8 和 ARMv7 架构 CPU 的各种开发板,例如 RK3399,树莓派等,目前支持交叉编译和本地编译两种方式,对于交叉编译方式,在完成目标程序编译后,可通过 scp 方式将程序拷贝到开发板运行。
##### 交叉编译
###### 编译环境要求
- gcc、g++、git、make、wget、python、scp
- cmake(建议使用3.10或以上版本)
###### 具体步骤
安装软件部分以 Ubuntu 为例,其他 Linux 发行版类似。
```shell
# 1. Install basic software
apt update
apt-get install -y --no-install-recommends \
gcc g++ git make wget python unzip
# 2. Install arm gcc toolchains
apt-get install -y --no-install-recommends \
g++-arm-linux-gnueabi gcc-arm-linux-gnueabi \
g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# 3. Install cmake 3.10 or above
wget -c https://mms-res.cdn.bcebos.com/cmake-3.10.3-Linux-x86_64.tar.gz && \
tar xzf cmake-3.10.3-Linux-x86_64.tar.gz && \
mv cmake-3.10.3-Linux-x86_64 /opt/cmake-3.10 && \
ln -s /opt/cmake-3.10/bin/cmake /usr/bin/cmake && \
ln -s /opt/cmake-3.10/bin/ccmake /usr/bin/ccmake
```
##### 本地编译(直接在RK3399或树莓派上编译)
###### 编译环境要求
- gcc、g++、git、make、wget、python
- cmake(建议使用3.10或以上版本)
###### 具体步骤
安装软件部分以 Ubuntu 为例,其他 Linux 发行版本类似。
```shell
# 1. Install basic software
apt update
apt-get install -y --no-install-recomends \
gcc g++ make wget python unzip
# 2. install cmake 3.10 or above
wget https://www.cmake.org/files/v3.10/cmake-3.10.3.tar.gz
tar -zxvf cmake-3.10.3.tar.gz
cd cmake-3.10.3
./configure
make
sudo make install
```
之后可通过cmake --version查看cmake是否安装成功。
至此,完成 Linux 交叉编译环境的准备。 至此,完成 Linux 交叉编译环境的准备。
### 3、Mac OS 开发环境(只支持 tiny publish 编译 ) ### 3、Mac OS 开发环境(只支持 tiny publish 编译 )
...@@ -213,7 +278,7 @@ ios tiny publish支持的编译选项: ...@@ -213,7 +278,7 @@ ios tiny publish支持的编译选项:
```shell ```shell
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
``` ```
##### ARMLinux(目前只支持Docker编译) ##### ARMLinux
```shell ```shell
./lite/tools/build.sh \ ./lite/tools/build.sh \
--arm_os=armlinux \ --arm_os=armlinux \
...@@ -221,6 +286,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer ...@@ -221,6 +286,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
--arm_lang=gcc \ --arm_lang=gcc \
tiny_publish tiny_publish
``` ```
- `--arm_abi`: 树莓派3b使用armv7hf,RK3399使用armv8
#### 编译`full publish`动态库(**Mac OS下不支持**) #### 编译`full publish`动态库(**Mac OS下不支持**)
...@@ -233,7 +299,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer ...@@ -233,7 +299,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
--android_stl=c++_static \ --android_stl=c++_static \
full_publish full_publish
``` ```
##### ARMLinux(目前只支持Docker编译) ##### ARMLinux
```shell ```shell
./lite/tools/build.sh \ ./lite/tools/build.sh \
--arm_os=armlinux \ --arm_os=armlinux \
...@@ -241,6 +307,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer ...@@ -241,6 +307,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
--arm_lang=gcc \ --arm_lang=gcc \
full_publish full_publish
``` ```
- `--arm_abi`: 树莓派3b使用armv7hf,RK3399使用armv8
### 编译结果说明 ### 编译结果说明
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册