Compilation failing for s390x, ppc64el, arm64, armhf architectures

Snapcraft is creating amd64 and i386 just fine but failing with the other archs.

Here an example failed log when building the s390x snap.

And here is the snapcraft.yaml file.

Any idea what is causing and how to fix this?

Looks like pyzmq failed to build due to missing libzmq headers. Maybe just replace stage-packages by build-packages? All of them are *-dev packages, which make more sense in the build stage.

  Running setup.py bdist_wheel for pyzmq: finished with status 'error'
  ...
  ...
  build/temp.linux-s390x-3.5/scratch/vers.c:4:17: fatal error: zmq.h: No such file or directory

I just tried your suggestion but I got this error instead. Any idea?

Failed to stage: Parts 'remofile' and 'yorokobi' have the following files, but with different contents:
    lib/python3.5/site-packages/zmq/backend/cython/_device.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/_poll.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/_version.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/constants.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/context.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/error.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/message.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/socket.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/backend/cython/utils.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/devices/monitoredqueue.cpython-35m-s390x-linux-gnu.so
    lib/python3.5/site-packages/zmq/utils/compiler.json
    lib/python3.5/site-packages/zmq/utils/config.json

Snapcraft offers some capabilities to solve this by use of the following keywords:
    - `filesets`
    - `stage`
    - `snap`
    - `organize`

To learn more about these part keywords, run `snapcraft help plugins`.
Build failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 231, in run
    self.build()
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 220, in build
    env=env)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 75, in run_build_command
    return self.backend.run(args, env=full_env, **kwargs)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py", line 460, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['lxc', 'exec', 'lp-xenial-s390x', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build_url": "https://launchpad.net/~build.snapcraft.io/+snap/9bc23507e335fb54c4484719e01a72a0-xenial/+build/429747"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/yorokobi && linux64 snapcraft']' returned non-zero exit status 2
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/slavebin/in-target scan-for-processes --backend=lxd --series=xenial --arch=s390x SNAPBUILD-429747
Scanning for processes to kill in build SNAPBUILD-429747

Full error log here

The ‘remofile’ and ‘yorokobi’ parts might have depend on the same library with the different versions, you should probably only stage the one that both parts are compatible with.

Looks like local binary builds of pyzmq's differ between the two parts, and snapcraft is unable to de-duplicate them. I wonder if their compilation is non-deterministic. In that case, I’d check that parts/*/install/lib/python3.5/site-packages/zmq/utils/compiler.json and parts/*/install/lib/python3.5/site-packages/zmq/utils/config.json do match in both parts, then exclude lib/python3.5/site-packages/zmq/ entirely from one part, e.g.:

   stage:
     - "-lib/python3.5/site-packages/zmq/"

Thanks! That worked.