How to use apt-get to download multi-arch library?
Is it possible to force apt-get to download a multi-architecture binary of the library I want to install?
Or is apt-get not the right tool for this?
3 Answers
@Tanasis's answer is correct, I have updated it for 2021 (Ubuntu 20.04 LTS) for arm64 and armhf.
Add your desired architectures as follows:
sudo dpkg --add-architecture armhfsudo dpkg --add-architecture arm64Create a new .list file in
/etc/apt/sources.list.d:sudo touch /etc/apt/sources.list.d/arm-cross-compile-sources.listAdd the default sources to that list with the architectures (armhf, arm64) prefixed as such:
deb [arch=armhf,arm64] focal main restricted deb [arch=armhf,arm64] focal-updates main restricted deb [arch=armhf,arm64] focal universe deb [arch=armhf,arm64] focal-updates universe deb [arch=armhf,arm64] focal multiverse deb [arch=armhf,arm64] focal-updates multiverse deb [arch=armhf,arm64] focal-backports main restricted universe multiverseUpdate
/etc/apt/sources.listto include your default architecture (if it doesn't already), otherwise apt will try to use your newly added architectures in those sources which may cause errors as it did with me. Add[arch=amd64]for each line in/etc/apt/sources.listas follows:deb [arch=amd64] focal main restricted universe multiverseRun
sudo apt updateand make sure you get no errorsInstalling a package with the new architectures should be successful now:
sudo apt install libasound2-dev:arm64
For arm64 I am doing the following on the /etc/apt/sources.list:
Ubuntu 16.04 (xenial) example:
I mark all the current (default) repos as [arch=<current_os_arch>], e.g.
deb [arch=amd64] xenial main restricted
And I added the following:
deb [arch=arm64] xenial main restricted
deb [arch=arm64] xenial-updates main restricted
deb [arch=arm64] xenial universe
deb [arch=arm64] xenial-updates universe
deb [arch=arm64] xenial multiverse
deb [arch=arm64] xenial-updates multiverse
deb [arch=arm64] xenial-backports main restricted universe multiverseNot sure if this is the corrent fix, but at least it seems to be working.
Note: Don't forget to add foreign architecture: dpkg --add-architecture arm64
First to enable multi-arch
dpkg --add-architecture <arch>Now setup apt-sources to add the new repositories of the new architecture(if you need)
now update your sources.list
sudo apt-get updateNow you can install multi-arch packages via apt-get regularly but you have to specify which architecture you want to download
apt-get install package:architectureexample:
apt-get install gedit:i386 7