如何为不同的 CPU 架构安装 libseccomp-dev

如何为不同的 CPU 架构安装 libseccomp-dev

我正在尝试在 Ubuntu bionic 上安装 libseccomp-dev:armhf(和 arm64)(Xenial 上也一样)。我这样做是因为我想交叉编译依赖于 libseccomp-dev 的东西。

这在 Ubuntu Focal 以及 Debian Stretch/Buster 上运行良好。

在 Ubuntu Xenial 和 Bionic 上,尝试为不同的 CPU 架构安装 libseccomp-dev 会尝试替换整个 C 工具链。示例输出附在底部。

我能做些什么来让它工作吗,或者 xenial 和 bionic 的包装有问题?

顺便说一句,我首先将所有默认的 apt 存储库设置为[arch=amd64],然后dpkg --add-architecture armhf将其附加deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports bionic main universe到源列表中。

root@7166f5911273:/# apt-get install libseccomp-dev:armhf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libseccomp-dev:armhf : Depends: libseccomp2:armhf (= 2.3.1-2.1ubuntu4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@7166f5911273:/# apt-get install libseccomp-dev:armhf libseccomp2:armhf 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libseccomp2:armhf : Depends: libc6:armhf (>= 2.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@7166f5911273:/# apt-get install libseccomp-dev:armhf libseccomp2:armhf libc6:armhf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6:armhf : Depends: libgcc1:armhf but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@7166f5911273:/# apt-get install libseccomp-dev:armhf libseccomp2:armhf libc6:armhf libgcc1:armhf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgcc1:armhf : Depends: gcc-8-base:armhf (= 8-20180414-1ubuntu2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@7166f5911273:/# apt-get install libseccomp-dev:armhf libseccomp2:armhf libc6:armhf libgcc1:armhf gcc-8-base:armhf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  autotools-dev bash-completion binutils-common distro-info-data gcc-7-base git-man gnupg-l10n iso-codes krb5-locales libglib2.0-data libldap-common libmagic-mgc libx11-data linux-libc-dev manpages manpages-dev mime-support
  netbase publicsuffix python-apt-common vim-runtime
Use 'apt autoremove' to remove them.
Suggested packages:
  glibc-doc:armhf debconf:armhf | debconf-2.0:armhf locales:armhf seccomp:armhf
The following packages will be REMOVED:
  adduser apt at autoconf automake autopoint base-files base-passwd bash binutils binutils-x86-64-linux-gnu bsdmainutils bsdutils build-essential bzip2 ca-certificates coreutils cpp cpp-7 curl dash dctrl-tools debconf debhelper
  debianutils devscripts dh-autoreconf dh-strip-nondeterminism diffstat diffutils dirmngr dpkg dpkg-dev dput e2fsprogs equivs fakeroot fdisk file findutils g++ g++-7 gcc gcc-7 gcc-8-base gettext gettext-base git gnupg gnupg-utils
  gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv grep groff-base gzip hostname init-system-helpers intltool-debian less libacl1 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libapt-inst2.0 libapt-pkg-perl libapt-pkg5.0 libarchive-cpio-perl libarchive-zip-perl libasan4 libasn1-8-heimdal libassuan0 libatomic1 libattr1 libaudit1 libauthen-sasl-perl libb-hooks-endofscope-perl libb-hooks-op-check-perl
  libbinutils libblkid1 libbsd0 libbz2-1.0 libc-bin libc-dev-bin libc6 libc6-dev libcap-ng0 libcc1-0 libcgi-fast-perl libcgi-pm-perl libcilkrts5 libclass-accessor-perl libclass-method-modifiers-perl libclass-xsaccessor-perl
  libclone-perl libcom-err2 libcroco3 libcurl3-gnutls libcurl4 libdata-dump-perl libdata-optlist-perl libdb5.3 libdebconfclient0 libdevel-callchecker-perl libdevel-globaldestruction-perl libdigest-hmac-perl libdistro-info-perl
  libdpkg-perl libdynaloader-functions-perl libedit2 libemail-valid-perl libencode-locale-perl liberror-perl libexpat1 libexporter-tiny-perl libext2fs2 libfakeroot libfcgi-perl libfdisk1 libffi6 libfile-basedir-perl
  libfile-chdir-perl libfile-fcntllock-perl libfile-homedir-perl libfile-listing-perl libfile-stripnondeterminism-perl libfile-which-perl libfont-afm-perl libgcc-7-dev libgcc1 libgcrypt20 libgdbm-compat4 libgdbm5
  libgetopt-long-descriptive-perl libgit-wrapper-perl libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgpg-error0 libgpgme11 libgpm2 libgssapi-krb5-2 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
  libhogweed4 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl
  libhx509-5-heimdal libicu60 libidn2-0 libimport-into-perl libio-html-perl libio-pty-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-string-perl libio-stringy-perl libipc-run-perl libipc-system-simple-perl libisl19
  libitm1 libk5crypto3 libkeyutils1 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libksba8 libldap-2.4-2 liblist-compare-perl liblist-moreutils-perl liblocale-gettext-perl liblsan0 libltdl-dev libltdl7 liblwp-mediatypes-perl
  liblwp-protocol-https-perl liblz4-1 liblzma5 libmagic1 libmail-sendmail-perl libmailtools-perl libmodule-implementation-perl libmodule-runtime-perl libmoo-perl libmount1 libmpc3 libmpdec2 libmpfr6 libmpx2 libnamespace-clean-perl
  libncurses5 libncursesw5 libnet-dns-perl libnet-domain-tld-perl libnet-http-perl libnet-ip-perl libnet-smtp-ssl-perl libnet-ssleay-perl libnettle6 libnghttp2-14 libnpth0 libnumber-compare-perl libnumber-range-perl libp11-kit0
  libpackage-stash-perl libpackage-stash-xs-perl libpam-modules libpam-modules-bin libpam-runtime libpam0g libparams-classify-perl libparams-util-perl libparams-validate-perl libparse-debianchangelog-perl
  libpath-iterator-rule-perl libpath-tiny-perl libpcre3 libperl5.26 libperlio-gzip-perl libpipeline1 libpod-constants-perl libprocps6 libpsl5 libpython3-stdlib libpython3.6 libpython3.6-minimal libpython3.6-stdlib libquadmath0
  libreadline7 libregexp-pattern-license-perl libroken18-heimdal librole-tiny-perl librtmp1 libsasl2-2 libsasl2-modules libsasl2-modules-db libseccomp2 libselinux1 libsemanage1 libsepol1 libsigsegv2 libsmartcols1 libsocket6-perl
  libsort-key-perl libsort-versions-perl libsqlite3-0 libss2 libssl1.0.0 libssl1.1 libstdc++-7-dev libstdc++6 libstrictures-perl libstring-copyright-perl libstring-escape-perl libsub-exporter-perl libsub-exporter-progressive-perl
  libsub-identify-perl libsub-install-perl libsub-name-perl libsub-quote-perl libsys-hostname-long-perl libsystemd0 libtasn1-6 libtext-glob-perl libtext-levenshtein-perl libtimedate-perl libtinfo5 libtool libtry-tiny-perl libtsan0
  libubsan0 libudev1 libunicode-utf8-perl libunistring2 libunwind8 liburi-perl libuuid1 libvariable-magic-perl libwind0-heimdal libwww-perl libwww-robotrules-perl libx11-6 libxau6 libxcb1 libxdmcp6 libxext6 libxml-libxml-perl
  libxml-namespacesupport-perl libxml-parser-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl libxml-simple-perl libxml2 libxmuu1 libyaml-0-2 libyaml-libyaml-perl libzstd1 licensecheck lintian login lsb-release m4
  make man-db mawk mount multiarch-support ncurses-bin openssh-client openssl passwd patch patchutils perl perl-base perl-modules-5.26 perl-openssl-defaults pinentry-curses po-debconf procps python3 python3-apt python3-certifi
  python3-chardet python3-debian python3-gpg python3-idna python3-magic python3-minimal python3-pkg-resources python3-requests python3-six python3-unidiff python3-urllib3 python3-xdg python3.6 python3.6-minimal readline-common sed
  shared-mime-info strace sysvinit-utils t1utils tar ucf unzip util-linux vim vim-common wdiff xauth xdg-user-dirs xxd xz-utils zlib1g
The following NEW packages will be installed:
  gcc-8-base:armhf libc6:armhf libgcc1:armhf libseccomp-dev:armhf libseccomp2:armhf
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt adduser (due to apt) gpgv (due to apt) libapt-pkg5.0 (due to apt) libc6 (due to apt) libgcc1 (due to apt) libgnutls30 (due to apt) libseccomp2 (due to apt) libstdc++6 (due to apt) base-files base-passwd
  libdebconfclient0 (due to base-passwd) bash libtinfo5 (due to bash) debianutils (due to bash) bsdutils libsystemd0 (due to bsdutils) coreutils libacl1 (due to coreutils) libattr1 (due to coreutils) libselinux1 (due to coreutils)
  dash dpkg (due to dash) diffutils libbz2-1.0 (due to dpkg) liblzma5 (due to dpkg) libzstd1 (due to dpkg) zlib1g (due to dpkg) tar (due to dpkg) e2fsprogs libblkid1 (due to e2fsprogs) libcom-err2 (due to e2fsprogs)
  libext2fs2 (due to e2fsprogs) libss2 (due to e2fsprogs) libuuid1 (due to e2fsprogs) fdisk libfdisk1 (due to fdisk) libmount1 (due to fdisk) libncursesw5 (due to fdisk) libsmartcols1 (due to fdisk) findutils grep
  libpcre3 (due to grep) gzip hostname init-system-helpers perl-base (due to init-system-helpers) libc-bin login libaudit1 (due to login) libpam0g (due to login) libpam-runtime (due to login) libpam-modules (due to login) mount
  util-linux (due to mount) ncurses-bin sed sysvinit-utils libudev1 (due to util-linux)
0 upgraded, 5 newly installed, 371 to remove and 0 not upgraded.
Need to get 2346 kB of archives.
After this operation, 464 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'

答案1

我通过将我的 apt 源精简为答案中列出的内容来解决这个问题交叉编译 armhf 并安装静态库这似乎很有效。

例子:

deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial main multiverse restricted universe
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ xenial main multiverse restricted universe
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial-updates main multiverse restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ xenial-security main multiverse restricted universe

相关内容