Snap does not pass review tools with build-on: all

I am packing a Python program which uses numpy, scipy and spglib libraries.

I tried to push it to the store with build-on: all but review-tools complained that:

found binaries for architecture ‘all’: lib/python3.6/site-packages/numpy.libs/, lib/python3.6/site-packages/numpy.libs/,

usr/local/lib/ lint-snap-v2_valid_contents_for_architecture

It switched to a list, i.e. build-on: [amd64, i386, arm64, armhf, ppc64el, s390x] and it passes the test.

Why does it fail the test with all but passes it with the list? I thought all is equivalent to the list above (based on the docs

As described in the documentation, build-on: all will produce a snap that claims it can run on any architecture. So the same snap would be delivered to both an x86 PC and an ARM 64 device.

The .so files contain machine code specific to a particular architecture. This might be okay if the snap contains machine code for all the architectures it supports and picks the correct executables/libraries at runtime, but it usually indicates a misconfigured snap. While your code might be architecture independent, the support libraries you’ve pulled into your snap are not.

Thanks, I will check the libraries again.

Why the snap does not fail the test with build-on: [amd64, i386, arm64, armhf, ppc64el, s390x]? The documentation leaves me with the impression that it is equivalent to build-on: all.

build-on: all doesn’t mean “build on all architectures”, sadly. Note from the docs “With none specified, a snap is built on all architectures.” and "the default value for run-on is the value of build-on". So by specifying all for build-on you’re effectively saying run-on: all too. If your snap contains a binary, that isn’t going to work - armhf not being able to run x86 binaries etc.
I’d use build-on: [armhf, armhf, i386, amd64, ppc64el, s390x] assuming you’re confident it works on all, and want to support it on all.

Ops, it seems I misunderstood build-on: all and what all does.

My program will be only on amd64 but for the sake of completeness, if I am running on an amd64 host and I have:

  - build-on: amd64
    run-on: [amd64, i386, arm64, armhf, ppc64el, s390x]

it is equivalent to example 2 in the docs:

  - build-on: amd64
    run-on: all

If you only want to build an amd64 snap, then use:

 - build-on: amd64

Your first fragment will build a single snap that claims to run on six different architectures. Your second fragment will build a single snap that claims to run on all architectures.