Hi,
Not sure if this is still a problem for you, but see my answer to a similar problem: Stage-Packages with --target-arch
Not sure if you ran into this problem, but you may need to use quotes around the package name, i.e. instead of stage-packages: [iperf3:armhf]
, you need to do stage-packages: ["iperf3:armhf"]
.
For reference, this is my (minimal) /etc/apt/sources.list
that works for my cross-compiled stage-packages (and also for your iperf3 package):
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ xenial-security main restricted
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ xenial-security universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ xenial-security multiverse
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports xenial main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports xenial-security main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports xenial-updates main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports xenial-backports main universe
Note that I also specify ports.ubuntu.com for arm64 so I can also cross compile for arm64, this isn’t necessary if you’re just building for armhf. Also note that you don’t need the deb-src
lines if you’re just installing the package.
I was able to build a snap with the following minimal part definition (the rest of the snapcraft.yaml removed for clarity):
parts:
my-part:
plugin: nil
stage-packages:
- on amd64 to armhf:
- "iperf3:armhf"
- else:
- "iperf3"
Also note that I invoked snapcraft as snapcraft --target-arch=armhf
on an Ubuntu 16.04 classic VM and it downloaded the correct package and installed it in the snap.