我正在尝试为 ARMv7 交叉编译一些库,其中一个所需的先决条件是 python3-dev:armhf。
我从一个新的 debian docker-container(docker pull debian)开始,因此这应该很容易重现。
我在容器内执行以下命令:
dpkg --add-architecture armhf && apt update && apt install python3-dev:armhf
虽然前两个命令运行正常,但第三个命令却不行。
这是完整的输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
bzip2 dh-python file gcc-6-base:armhf libbz2-1.0:armhf libc-dev-bin libc6:armhf libc6-dev:armhf libdb5.3:armhf libexpat1:armhf libexpat1-dev:armhf libgcc1:armhf libgpm2:armhf liblzma5:armhf libmagic-mgc
libmagic1 libmpdec2:armhf libncursesw5:armhf libpython3-dev:armhf libpython3-stdlib:armhf libpython3.5:armhf libpython3.5-dev:armhf libpython3.5-minimal:armhf libpython3.5-stdlib:armhf libreadline7:armhf
libsqlite3-0:armhf libssl1.1:armhf libtinfo5:armhf linux-libc-dev:armhf manpages manpages-dev mime-support python3:armhf python3-minimal:armhf python3.5:armhf python3.5-dev:armhf python3.5-minimal:armhf
readline-common xz-utils zlib1g:armhf
Suggested packages:
bzip2-doc libdpkg-perl glibc-doc:armhf libc-l10n:armhf locales:armhf gpm:armhf man-browser python3-doc:armhf python3-tk:armhf python3-venv:armhf python3.5-venv:armhf python3.5-doc:armhf binutils:armhf
binfmt-support:armhf readline-doc
The following NEW packages will be installed:
bzip2 dh-python file gcc-6-base:armhf libbz2-1.0:armhf libc-dev-bin libc6:armhf libc6-dev:armhf libdb5.3:armhf libexpat1:armhf libexpat1-dev:armhf libgcc1:armhf libgpm2:armhf liblzma5:armhf libmagic-mgc
libmagic1 libmpdec2:armhf libncursesw5:armhf libpython3-dev:armhf libpython3-stdlib:armhf libpython3.5:armhf libpython3.5-dev:armhf libpython3.5-minimal:armhf libpython3.5-stdlib:armhf libreadline7:armhf
libsqlite3-0:armhf libssl1.1:armhf libtinfo5:armhf linux-libc-dev:armhf manpages manpages-dev mime-support python3:armhf python3-dev:armhf python3-minimal:armhf python3.5:armhf python3.5-dev:armhf
python3.5-minimal:armhf readline-common xz-utils zlib1g:armhf
0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.9 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://security-cdn.debian.org/debian-security stretch/updates/main armhf linux-libc-dev armhf 4.9.168-1+deb9u2 [1398 kB]
Get:2 http://cdn-fastly.deb.debian.org/debian stretch/main armhf gcc-6-base armhf 6.3.0-18+deb9u1 [180 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libgcc1 armhf 1:6.3.0-18+deb9u1 [38.5 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libc6 armhf 2.24-11+deb9u4 [2341 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libssl1.1 armhf 1.1.0j-1~deb9u1 [1147 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libpython3.5-minimal armhf 3.5.3-1+deb9u1 [565 kB]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libexpat1 armhf 2.2.0-2+deb9u1 [64.4 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main armhf zlib1g armhf 1:1.2.8.dfsg-5 [82.4 kB]
Get:9 http://cdn-fastly.deb.debian.org/debian stretch/main armhf python3.5-minimal armhf 3.5.3-1+deb9u1 [1441 kB]
Get:10 http://cdn-fastly.deb.debian.org/debian stretch/main armhf python3-minimal armhf 3.5.3-1 [35.3 kB]
Get:11 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 mime-support all 3.60 [36.7 kB]
Get:12 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libbz2-1.0 armhf 1.0.6-8.1 [41.9 kB]
Get:13 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libdb5.3 armhf 5.3.28-12+deb9u1 [595 kB]
Get:14 http://cdn-fastly.deb.debian.org/debian stretch/main armhf liblzma5 armhf 5.2.2-1.2+b1 [226 kB]
Get:15 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libmpdec2 armhf 2.4.2-1 [69.6 kB]
Get:16 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libtinfo5 armhf 6.0+20161126-1+deb9u2 [288 kB]
Get:17 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libncursesw5 armhf 6.0+20161126-1+deb9u2 [94.8 kB]
Get:18 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 readline-common all 7.0-3 [70.4 kB]
Get:19 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libreadline7 armhf 7.0-3 [131 kB]
Get:20 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libsqlite3-0 armhf 3.16.2-5+deb9u1 [499 kB]
Get:21 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libpython3.5-stdlib armhf 3.5.3-1+deb9u1 [2085 kB]
Get:22 http://cdn-fastly.deb.debian.org/debian stretch/main armhf python3.5 armhf 3.5.3-1+deb9u1 [229 kB]
Get:23 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libpython3-stdlib armhf 3.5.3-1 [18.6 kB]
Get:24 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 dh-python all 2.20170125 [86.8 kB]
Get:25 http://cdn-fastly.deb.debian.org/debian stretch/main armhf python3 armhf 3.5.3-1 [21.6 kB]
Get:26 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 bzip2 amd64 1.0.6-8.1 [47.5 kB]
Get:27 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libmagic-mgc amd64 1:5.30-1+deb9u2 [222 kB]
Get:28 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libmagic1 amd64 1:5.30-1+deb9u2 [111 kB]
Get:29 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 file amd64 1:5.30-1+deb9u2 [64.1 kB]
Get:30 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libgpm2 armhf 1.20.4-6.2+b1 [33.3 kB]
Get:31 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 manpages all 4.10-2 [1222 kB]
Get:32 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 xz-utils amd64 5.2.2-1.2+b1 [266 kB]
Get:33 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libc-dev-bin amd64 2.24-11+deb9u4 [259 kB]
Get:34 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libc6-dev armhf 2.24-11+deb9u4 [1995 kB]
Get:35 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libexpat1-dev armhf 2.2.0-2+deb9u1 [116 kB]
Get:36 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libpython3.5 armhf 3.5.3-1+deb9u1 [1204 kB]
Get:37 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libpython3.5-dev armhf 3.5.3-1+deb9u1 [37.0 MB]
Get:38 http://cdn-fastly.deb.debian.org/debian stretch/main armhf libpython3-dev armhf 3.5.3-1 [18.7 kB]
Get:39 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 manpages-dev all 4.10-2 [2145 kB]
Get:40 http://cdn-fastly.deb.debian.org/debian stretch/main armhf python3.5-dev armhf 3.5.3-1+deb9u1 [413 kB]
Get:41 http://cdn-fastly.deb.debian.org/debian stretch/main armhf python3-dev armhf 3.5.3-1 [1158 B]
Fetched 56.9 MB in 5s (10.8 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package gcc-6-base:armhf.
(Reading database ... 6499 files and directories currently installed.)
Preparing to unpack .../0-gcc-6-base_6.3.0-18+deb9u1_armhf.deb ...
Unpacking gcc-6-base:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libgcc1:armhf.
Preparing to unpack .../1-libgcc1_1%3a6.3.0-18+deb9u1_armhf.deb ...
Unpacking libgcc1:armhf (1:6.3.0-18+deb9u1) ...
Selecting previously unselected package libc6:armhf.
Preparing to unpack .../2-libc6_2.24-11+deb9u4_armhf.deb ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Unpacking libc6:armhf (2.24-11+deb9u4) ...
Selecting previously unselected package libssl1.1:armhf.
Preparing to unpack .../3-libssl1.1_1.1.0j-1~deb9u1_armhf.deb ...
Unpacking libssl1.1:armhf (1.1.0j-1~deb9u1) ...
Selecting previously unselected package libpython3.5-minimal:armhf.
Preparing to unpack .../4-libpython3.5-minimal_3.5.3-1+deb9u1_armhf.deb ...
Unpacking libpython3.5-minimal:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package libexpat1:armhf.
Preparing to unpack .../5-libexpat1_2.2.0-2+deb9u1_armhf.deb ...
Unpacking libexpat1:armhf (2.2.0-2+deb9u1) ...
Selecting previously unselected package zlib1g:armhf.
Preparing to unpack .../6-zlib1g_1%3a1.2.8.dfsg-5_armhf.deb ...
Unpacking zlib1g:armhf (1:1.2.8.dfsg-5) ...
Setting up gcc-6-base:armhf (6.3.0-18+deb9u1) ...
Setting up libgcc1:armhf (1:6.3.0-18+deb9u1) ...
Setting up libc6:armhf (2.24-11+deb9u4) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Selecting previously unselected package python3.5-minimal:armhf.
(Reading database ... 7057 files and directories currently installed.)
Preparing to unpack .../00-python3.5-minimal_3.5.3-1+deb9u1_armhf.deb ...
Unpacking python3.5-minimal:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package python3-minimal:armhf.
Preparing to unpack .../01-python3-minimal_3.5.3-1_armhf.deb ...
Unpacking python3-minimal:armhf (3.5.3-1) ...
Selecting previously unselected package mime-support.
Preparing to unpack .../02-mime-support_3.60_all.deb ...
Unpacking mime-support (3.60) ...
Selecting previously unselected package libbz2-1.0:armhf.
Preparing to unpack .../03-libbz2-1.0_1.0.6-8.1_armhf.deb ...
Unpacking libbz2-1.0:armhf (1.0.6-8.1) ...
Selecting previously unselected package libdb5.3:armhf.
Preparing to unpack .../04-libdb5.3_5.3.28-12+deb9u1_armhf.deb ...
Unpacking libdb5.3:armhf (5.3.28-12+deb9u1) ...
Selecting previously unselected package liblzma5:armhf.
Preparing to unpack .../05-liblzma5_5.2.2-1.2+b1_armhf.deb ...
Unpacking liblzma5:armhf (5.2.2-1.2+b1) ...
Selecting previously unselected package libmpdec2:armhf.
Preparing to unpack .../06-libmpdec2_2.4.2-1_armhf.deb ...
Unpacking libmpdec2:armhf (2.4.2-1) ...
Selecting previously unselected package libtinfo5:armhf.
Preparing to unpack .../07-libtinfo5_6.0+20161126-1+deb9u2_armhf.deb ...
Unpacking libtinfo5:armhf (6.0+20161126-1+deb9u2) ...
Selecting previously unselected package libncursesw5:armhf.
Preparing to unpack .../08-libncursesw5_6.0+20161126-1+deb9u2_armhf.deb ...
Unpacking libncursesw5:armhf (6.0+20161126-1+deb9u2) ...
Selecting previously unselected package readline-common.
Preparing to unpack .../09-readline-common_7.0-3_all.deb ...
Unpacking readline-common (7.0-3) ...
Selecting previously unselected package libreadline7:armhf.
Preparing to unpack .../10-libreadline7_7.0-3_armhf.deb ...
Unpacking libreadline7:armhf (7.0-3) ...
Selecting previously unselected package libsqlite3-0:armhf.
Preparing to unpack .../11-libsqlite3-0_3.16.2-5+deb9u1_armhf.deb ...
Unpacking libsqlite3-0:armhf (3.16.2-5+deb9u1) ...
Selecting previously unselected package libpython3.5-stdlib:armhf.
Preparing to unpack .../12-libpython3.5-stdlib_3.5.3-1+deb9u1_armhf.deb ...
Unpacking libpython3.5-stdlib:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package python3.5:armhf.
Preparing to unpack .../13-python3.5_3.5.3-1+deb9u1_armhf.deb ...
Unpacking python3.5:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package libpython3-stdlib:armhf.
Preparing to unpack .../14-libpython3-stdlib_3.5.3-1_armhf.deb ...
Unpacking libpython3-stdlib:armhf (3.5.3-1) ...
Selecting previously unselected package dh-python.
Preparing to unpack .../15-dh-python_2.20170125_all.deb ...
Unpacking dh-python (2.20170125) ...
Setting up libssl1.1:armhf (1.1.0j-1~deb9u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libpython3.5-minimal:armhf (3.5.3-1+deb9u1) ...
Setting up libexpat1:armhf (2.2.0-2+deb9u1) ...
Setting up zlib1g:armhf (1:1.2.8.dfsg-5) ...
Setting up python3.5-minimal:armhf (3.5.3-1+deb9u1) ...
/var/lib/dpkg/info/python3.5-minimal.postinst: 46: /var/lib/dpkg/info/python3.5-minimal.postinst: python3.5: Exec format error
dpkg: error processing package python3.5-minimal:armhf (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of python3-minimal:armhf:
python3-minimal:armhf depends on python3.5-minimal (>= 3.5.3-1~); however:
Package python3.5-minimal:armhf is not configured yet.
dpkg: error processing package python3-minimal:armhf (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python3.5-minimal:armhf
python3-minimal:armhf
E: Sub-process /usr/bin/dpkg returned an error code (1)
根据这份文件,我的印象是这就是所需要的一切:https://wiki.debian.org/Multiarch/HOWTO
但是,我似乎遗漏了一些东西。设置 armhf 软件包源并安装它们的正确工作流程是什么?
编辑:经过进一步调查,似乎我可以安装除 armhf 的 python 之外的所有内容。安装以下先决条件:
libgtk-3-dev:armhf libcanberra-gtk3-dev:armhf libtiff-dev:armhf zlib1g-dev:armhf libjpeg-dev:armhf libpng-dev:armhf libavcodec-dev:armhf libavformat-dev:armhf libswscale-dev:armhf libv4l-dev:armhf libxvidcore-dev:armhf libx264-dev:armhf
工作正常,尝试为 armhf 安装任何 python 后 apt 中断。
因此,这似乎是 python 特有的依赖项/配置错误。根据这个答案:Debian multiarch:无法为 armhf 和 amd64 安装 pythonDebian 不允许系统上同时有多个 python 解释器,但是我一开始并没有一个,因为我只是从一个最小设置开始。