ubuntu 18.04 64bit下如何源码编译安装anbox

1. 准备工作

  1.1 安装gcc 7.x版本

  sudo apt-get install gcc-7 -y

  1.2 安装依赖的库及其工具

sudo apt install build-essential cmake cmake-data debhelper dbus google-mock \
    libboost-dev libboost-filesystem-dev libboost-log-dev libboost-iostreams-dev \
    libboost-program-options-dev libboost-system-dev libboost-test-dev \
    libboost-thread-dev libcap-dev libsystemd-dev libegl1-mesa-dev \
    libgles2-mesa-dev libglm-dev libgtest-dev liblxc1 \
    libproperties-cpp-dev libprotobuf-dev libsdl2-dev libsdl2-image-dev lxc-dev \
    pkg-config protobuf-compiler -y

   1.3 安装snapcraft打包工具

   sudo apt-get install snapcraft -y

 

2. 获取源码

git clone https://github.com/anbox/anbox.git ~/anbox

cd ~/anbox

3. 创建编译目录

mkdir ~/anbox/build

cd ~/anbox/build

4. 生成Makefile

cmake ..

5. 编译

make -j4

6. 打包成snap包

mkdir ~/anbox/android-images

wget -O ~/anbox/android-images/android.img https://build.anbox.io/android-images/2018/07/19/android_amd64.img

cd ~/anbox

snapcraft

  错误处理:

  6.1 Failed to fetch stage packages: Error downloading packages for part 'anbox': The
 package 'libboost-program-options1.58.0' was not found..

  直接修改~/anbox/snap/snapcraft.yaml文件中的软件包名

    stage-packages:
          - libboost-log1.58.0 -> - libboost-log1.62.0
          - libboost-iostreams1.58.0 -> - libboost-iostreams1.62.0
          - libboost-program-options1.58.0 -> - libboost-program-options1.62.0
          - libboost-thread1.58.0 -> - libboost-thread1.62.0

  6.2 Cloning into '/home/jello/develop/source/github/anbox/parts/swiftshader/src'...
fatal: unable to access 'https://swiftshader.googlesource.com/SwiftShader/': Fai
led to connect to swiftshader.googlesource.com port 443: Connection timed out   
Sorry, an error occurred in Snapcraft:

    修改~/anbox/snap/snapcraft.yaml中的以下内容:

        swiftshader:
          plugin: cmake
          source: https://swiftshader.googlesource.com/SwiftShader -> https://github.com/google/swiftshader.git

  6.3 The linker version '2.23' used by the base 'core' is incompatible with files in this snap:

    sudo snap install lxd

    sudo lxd init

    sudo snapcraft cleanbuild

 

 7. 安装生成的snap包

snap install --dangerous --devmode ~/anbox/*.snap

 

posted @ 2019-05-18 09:24  Jello  阅读(4065)  评论(0编辑  收藏  举报