无法打开共享库(快照)

无法打开共享库(快照)

我遇到了与为 ARM64 设备创建的 snap Anbox 相关的问题。

我成功构建了它,我甚至没有在启动阶段收到警告(即我没有被要求将某些文件迁移到 snap 或 smth)。

但是当我尝试安装它时:

snap install --devmode anbox_4-6db91b2_arm64.snap

我收到此错误:

  • 如果存在,运行“anbox”snap 的安装钩子(运行钩子“安装”:

    realpath: '': No such file or directory
    realpath: '': No such file or directory
    realpath: '': No such file or directory
    realpath: '': No such file or directory
    realpath: '': No such file or directory
    realpath: '': No such file or directory
    realpath: '': No such file or directory
    realpath: '': No such file or directory
    
    /snap/anbox/x1/usr/bin/anbox: error while loading shared libraries: libdw.so.1: cannot open shared object file: No such file or directory
    

任何想法 ?

这是我的snapcraft.yaml

name: anbox
version: 4
base: core18
version-script: |
  if [ "$SNAPCRAFT_GRADE" = "stable" ]; then
    echo $SNAPCRAFT_PROJECT_VERSION
  else
    echo $SNAPCRAFT_PROJECT_VERSION-$(git rev-parse --short HEAD)
  fi
summary: Android in a Box
description: |
  Runtime for Android applications which runs a full Android system
  in a container using Linux namespaces (user, ipc, net, mount) to
  separate the Android system fully from the host.
confinement: devmode
grade: devel
architectures: [arm64]

slots:
  dbus-session-slot:
    interface: dbus
    bus: session
    name: org.anbox

plugs:
  dbus-session-plug:
    interface: dbus
    bus: session
    name: org.anbox

apps:
  anbox:
    command: desktop-launch $SNAP/bin/anbox-wrapper.sh
    slots:
      - dbus-session-slot
    plugs:
      - x11
      - unity7
      - network
      - opengl
      - wayland
      - pulseaudio
      - home
      - process-control
      - desktop

  container-manager:
    command: bin/container-manager.sh start
    stop-command: bin/container-manager.sh stop
    daemon: simple
    plugs:
      - firewall-control
      - mount-observe
      - network-control
      - network-bind

  collect-bug-info:
    command: bin/collect-bug-info.sh
  shell:
    command: bin/anbox-shell.sh
  android-settings:
    command: desktop-launch $SNAP/bin/app-android-settings.sh
    desktop: desktop/android-settings.desktop
    slots:
      - dbus-session-slot
    plugs:
      - dbus-session-plug
      - x11
      - unity7
      - network
      - opengl
      - wayland
      - pulseaudio
      - home
      - process-control
      - desktop

  appmgr:
    command: desktop-launch $SNAP/bin/app-appmgr.sh
    desktop: desktop/appmgr.desktop
    slots:
      - dbus-session-slot
    plugs:
      - dbus-session-plug
      - x11
      - unity7
      - network
      - opengl
      - wayland
      - pulseaudio
      - home
      - process-control
      - desktop

parts:
  android:
    plugin: dump
    # This needs to be any directory but not the root one as if we use
    # it we get superious permissions errors with the copied .git tree
    source: data
    build-packages:
      - wget
    override-build: |
      LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img
      if [ -f $LOCAL_IMAGE ]; then
        echo "Using local image $LOCAL_IMAGE"
        cp $LOCAL_IMAGE $SNAPCRAFT_PART_INSTALL/android.img
      else
        IMAGE_PATH=
        IMAGE_NAME=
        ARCH=arm64
        case "$ARCH" in
          arm64)
            IMAGE_PATH="2017/08/04"
            IMAGE_NAME="android_1_arm64.img"
            IMAGE_HASH="e52da14ab5ee6f5274a102193d7e92382a1a7b5b87154f8cf280037bfa7ddb0b"
            ;;
          *)
            echo "ERROR: Unknown architecture $ARCH"
            exit 1
            ;;
        esac
        # FIXME: downloading with a source: field doesn't work as snapcraft
        # expects the downloaded file to be an archive it can extract.
        echo "Downloading image..."
        wget http://build.anbox.io/android-images/$IMAGE_PATH/$IMAGE_NAME
        echo "$IMAGE_HASH $IMAGE_NAME" > image-hash
        sha256sum -c image-hash
        mv $IMAGE_NAME $SNAPCRAFT_PART_INSTALL/android.img
      fi
    prime:
      - android.img

  apparmor:
    plugin: nil
    stage-packages:
      - apparmor

  zip:
    plugin: nil
    stage-packages:
      - zip
    prime:
      - usr/bin/zip

  lxc:
    source: https://github.com/lxc/lxc
    source-type: git
    source-tag: lxc-3.0.1
    build-packages:
      - libapparmor-dev
      - libcap-dev
      - libgnutls28-dev
      - libseccomp-dev
      - pkg-config
    plugin: autotools
    configflags:
      - --disable-selinux
      - --disable-python
      - --disable-lua
      - --disable-tests
      - --disable-examples
      - --disable-doc
      - --disable-api-docs
      - --disable-bash
      - --disable-cgmanager
      - --enable-apparmor
      - --enable-seccomp
      - --enable-capabilities
      - --with-rootfs-path=/var/snap/anbox/common/lxc/
      - --libexecdir=/snap/anbox/current/libexec/
    override-build: |
      set -ex
      git config user.email "[email protected]"
      git config user.name "Anbox Buildbot"
      git remote add anbox https://github.com/anbox/lxc
      git fetch anbox
      # apparmor: don't require a transition for Anbox child profiles
      git cherry-pick 2f81fb7c91560b32e506bb874f8cd63e37985906
      set +ex
      snapcraftctl build
    organize:
      snap/anbox/current/libexec: libexec
    prime:
      - lib/liblxc.so.1
      - lib/liblxc.so.1.4.0
      - libexec/lxc/lxc-monitord
      - bin/lxc-start
      - bin/lxc-stop
      - bin/lxc-info
      - bin/lxc-attach
      - bin/lxc-ls
      - bin/lxc-top

  swiftshader:
    plugin: cmake
    source: https://swiftshader.googlesource.com/SwiftShader
    source-type: git
    # Points to latest head of branch android-emulator-current-release
    source-commit: 79acc73de8a455f79fb7e458719adc86aa798f07
    override-build: |
      git submodule update --init
      snapcraftctl build
    artifacts:
      - libEGL.so
      - libGLES_CM.so
      - libGLESv2.so
    organize:
      libEGL.so: lib/anbox/swiftshader/libEGL.so
      libGLES_CM.so: lib/anbox/swiftshader/libGLES_CM.so
      libGLESv2.so: lib/anbox/swiftshader/libGLESv2.so

  anbox-scripts:
    plugin: dump
    source: scripts
    organize:
      snap-wrapper.sh: bin/anbox-wrapper.sh
      container-manager.sh: bin/container-manager.sh
      anbox-bridge.sh: bin/anbox-bridge.sh
      collect-bug-info.sh: bin/collect-bug-info.sh
      app-android-settings.sh: bin/app-android-settings.sh
      app-appmgr.sh: bin/app-appmgr.sh
      anbox-shell.sh: bin/anbox-shell.sh
    prime:
      - bin/anbox-bridge.sh
      - bin/anbox-shell.sh
      - bin/anbox-wrapper.sh
      - bin/container-manager.sh
      - bin/collect-bug-info.sh
      - bin/app-*.sh

  anbox-data:
    plugin: dump
    source: data
    prime:
      - glvnd
      - desktop
      - apparmor
      - seccomp

  anbox:
    plugin: cmake
    after:
      - lxc
      - desktop-glib-only
    source: .
    configflags:
      # FIXME: Anbox currently has some paths with hard coded prefixes. Once
      # that is fixed we can avoid using a prefix here.
      - -DCMAKE_INSTALL_PREFIX:PATH=/usr
      - -DANBOX_VERSION=$SNAPCRAFT_PROJECT_VERSION
      # FIXME: Once we have everything in place for full snap confinement we
      # can securely enable this.
      # - -DSNAP_CONFINEMENT=ON
    build-packages:
      - build-essential
      - cmake
      - cmake-data
      - cmake-extras
      - 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
      - libdbus-1-dev
      - libdw-dev
      - libegl1-mesa-dev
      - libgles2-mesa-dev
      - libgtest-dev
      - libprotobuf-dev
      - libproperties-cpp-dev
      - libsdl2-dev
      - libsdl2-image-dev
      - libsystemd-dev
      - pkg-config
      - protobuf-compiler
    stage-packages:
      - libboost-log1.65.1
      - libboost-iostreams1.65.1
      - libboost-program-options1.65.1
      - libboost-thread1.65.1
      - libdb5.3
      - libdw1
      - libprotobuf-lite10
      - libegl1-mesa
      - libgles2-mesa
      - libgl1-mesa-glx
      - libsdl2-2.0-0
      - libsdl2-gfx-1.0-0
      - libsdl2-image-2.0-0
      - libsystemd0
      - libblkid1
      - libmount1
      - libpcre3
      - libselinux1
      - libuuid1
      - zlib1g
      - libseccomp2
      - libcap2
      - libgnutls30
      - libhogweed4
      - libidn2-0
      - libnettle6
      - libp11-kit0
      - libtasn1-6
      - libunistring2
      - libbz2-1.0
      - libgcc1
      - libgcrypt20
      - libgpg-error0
      - liblzma5
      - libtinfo5
      - libstdc++6
      - libncursesw5
    prime:
      - usr/bin/anbox
      - usr/share/anbox
      - usr/lib/aarch64-linux-gnu/

任何帮助,将不胜感激 !

问候

答案1

(我认为重新格式化帖子以便错误消息和 yaml 文件正确显示是一个好主意,我在这里手动重新格式化它但不是每个人都会这样做。)

似乎 libdw 在标准路径之外安装了一些库。尝试environment向应用程序添加一个条目来设置库路径,例如:

apps:
  anbox:
    ...
    environment:
      LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/elfutils"

相关内容