Skip to content

Commit

Permalink
Configure ports.ubuntu.com in APT sources
Browse files Browse the repository at this point in the history
The recommendation given in the README to use `dpkg --add-architecture` to install additional libraries doesn't actually work because the packages for most architectures are on a different server.

This change configures the APT sources so it knows where every architecture is located, and the recommendation given in the README works.

The package locations should be accurate for all current Ubuntu releases, although I have only tested it with 16.04 and just looked at the repository content for later versions.

I have tested these two shell commands in a docker image based on the official cross docker images. I think this would be the best place to put them so that all cross users can benefit from them, and they *should* work here but I've not tried to build an image.
  • Loading branch information
rvolgers authored and reitermarkus committed Feb 15, 2020
1 parent c91019c commit 3b07a08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
set -x
set -euo pipefail

# For architectures except amd64 and i386, look for packages on ports.ubuntu.com instead.
# This is important if you enable additional architectures so you can install libraries to cross-compile against.
# Look for 'dpkg --add-architecture' in the README for more details.
sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list > /etc/apt/sources.list.d/ports.list
sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list

apt-get update

apt-get install -y --no-install-recommends \
Expand Down

0 comments on commit 3b07a08

Please sign in to comment.