Skip to content

Commit 3b07a08

Browse files
rvolgersreitermarkus
authored andcommitted
Configure ports.ubuntu.com in APT sources
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.
1 parent c91019c commit 3b07a08

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docker/common.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
set -x
44
set -euo pipefail
55

6+
# For architectures except amd64 and i386, look for packages on ports.ubuntu.com instead.
7+
# This is important if you enable additional architectures so you can install libraries to cross-compile against.
8+
# Look for 'dpkg --add-architecture' in the README for more details.
9+
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
10+
sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list
11+
612
apt-get update
713

814
apt-get install -y --no-install-recommends \

0 commit comments

Comments
 (0)