Errors when trying to build snap package for ARM architecture (using Launchpad build infrastructure)

Hello!

I’m trying to build a snap for a Python2-based project I’m working on.

The snapcraft.yaml file is available on Launchpad.

The build works fine for amd64 architecture (both on my computer using snapcraft cleanbuild and on Launchpad), but it fails when I try to build for arm architecture:

In both cases, I see errors like:

Running setup.py bdist_wheel for cryptography: started
  Running setup.py bdist_wheel for cryptography: finished with status 'error'
  Complete output from command /build/qabro/parts/qabro/install/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-wheel-FksYhb/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-smvXGn:
  c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
  compilation terminated.
[…]
  distutils.errors.DistutilsError: Setup script exited with error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
[…]
Running setup.py bdist_wheel for cffi: started
  Running setup.py bdist_wheel for cffi: finished with status 'error'
  Complete output from command /build/qabro/parts/qabro/install/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-wheel-FksYhb/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-XUhgJC:
[…]
  aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/python2.7 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-aarch64-2.7/c/_cffi_backend.o
  c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
  compilation terminated.
  error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
[…]
Failed to build cryptography cffi
ERROR: Failed to build one or more wheels
Sorry, Snapcraft ran into an error when trying to running through its
lifecycle that generated the following traceback:
[…]
CalledProcessError: Command '['lxc', 'exec', 'lp-xenial-arm64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build_url": "https://snap-proxy.launchpad.net:3128', '--env', 'https_proxy=http://snap-proxy.launchpad.net:3128', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/qabro && linux64 snapcraft']' returned non-zero exit status 1

Does anyone know how this could be fixed?

Thanks!

seems you are missing a build dependency (you hopefully used “snapcraft cleanbuild” when building locally, else your computer now has all the build dependencies installed (which is why it works there i suppose)), add a “build-packages:” entry for libffi-dev to the part that fails …

1 Like

Thanks a lot @ogra !

I had to add a few other libs in order for the snap to build successfully on armhf and arm64.

Now I’m facing another issue: the snap can be installed on an armhf device, but it won’t run. I have the following output:

$ sudo qabro
/usr/bin/env: relocation error: /snap/qabro/x1/lib/arm-linux-gnueabihf/libc.so.6: symbol __tunable_get_val, version GLIBC_PRIVATE not defined in file ld-linux-armhf.so.3 with link time reference

Any idea?

looks like you have built on something newer than 16.04 and got the libc version from the host pulled in … if you build on launchpad, explicitly set 16.04 (i think there is a checkbox or something in the build form) as the version to build on.

Thanks a lot for the tip!

I followed your advice and got the release to build properly, and it was confirmed working on an armhf device.

Cheers!

1 Like