in my snapcraft.yaml all of my stage-packages are specified as follows
libcurl3:armhf
libssl1.0.0:armhf
It seems to be working, , but I just want to know if I am missing something…
the current issue I have is that there exists a package (iperf3) that works on the armhf (i installed it via apt-get outside of the snap app armor and it works) . when i add this:
iperf3:armhf
to my snapcraft.yaml i get the following error:
Error downloading stage packages for part ‘mypartname’: The package ‘iperf3:armhf’ was not found.
You may need to add support for this architecture with ‘dpkg --add-architecture armhf’.
if I remove the :armhf it builds the package, but the binary included in the snap is the wrong architecture.
So… is my cross staging/compiling setup correct? I suspect i might be missing a source… or maybe im using the wrong list of sources and just got lucky before.
my setup works - however, I can’t exactly say what I did to get it to work as I had to do a lot of traial and error… From my experience snap is really unpleasant to configure cross compiling… i might try and start over again using the newer features to see if there was any improvement… however this post seems like a typical ‘use case’ that should just be documented as a how to guide… but most of the snap documentation is(was?) useless except for the most trival of examples…
Thanks, if anything comes to mind or you ever end up needing to set it up I’d appreciate any tips.
So far the solution that works for me is running it natively on a Raspberry Pi host which isn’t ideal. I’m trying to setup a docker based solution on Circle CI but I’m having some issues with that as well.
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.