Recent Launchpad builds of a snap package I’m responsible for have been failing regularly when invoking cmake
– see e.g.:
https://launchpadlibrarian.net/412176750/buildlog_snap_ubuntu_xenial_amd64_ldc2-1.10_BUILDING.txt.gz
https://launchpadlibrarian.net/412176650/buildlog_snap_ubuntu_xenial_i386_ldc2-1.10_BUILDING.txt.gz
Building llvm
cmake /build/ldc2/parts/llvm/src -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=Release -DCOMPILER_RT_INCLUDE_TESTS=OFF -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_TARGETS_TO_BUILD=X86\;AArch64\;ARM\;PowerPC\;NVPTX
Failed to run 'cmake /build/ldc2/parts/llvm/src -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=Release -DCOMPILER_RT_INCLUDE_TESTS=OFF -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_TARGETS_TO_BUILD=X86\\;AArch64\\;ARM\\;PowerPC\\;NVPTX' for 'llvm': Exited with code -11.
Verify that the part is using the correct parameters and try again.
Build failed
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 230, in run
self.pull()
File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 195, in pull
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 497, 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-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build_url": "https://launchpad.net/~ldc-developers/+snap/ldc2-1.10/+build/468899"}', '--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/ldc2 && linux64 snapcraft pull']' returned non-zero exit status 2
The snap package definition is available here:
… and the specific part that’s failing to build is as follows:
llvm:
source: https://github.com/ldc-developers/llvm.git
source-tag: ldc-v6.0.1-3
source-type: git
plugin: cmake
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DCOMPILER_RT_INCLUDE_TESTS=OFF
- -DLLVM_BINUTILS_INCDIR=/usr/include
- -DLLVM_TARGETS_TO_BUILD=X86\;AArch64\;ARM\;PowerPC\;NVPTX
stage:
- -*
prime:
- -*
build-packages:
- binutils-dev
- g++
The package definition builds fine when I run snapcraft locally, but I can reproduce the error when I run snapcraft cleanbuild
. However, if I alternatively just run the cmake
command inside the LXD container, this works, which makes me suspect that there is a problem with how snapcraft
is invoking cmake
.
If I manually launch an LXD container, clone the snap package definition, and run snapcraft
inside the container, then success or failure depends on how I install snapcraft:
-
if I use
snap install --classic snapcraft
to install snapcraft 3.1.x as a snap package, then I reproduce the error -
if I use
apt install snapcraft
to install snapcraft 2.x from apt, then the build runs OK.
Where launchpad is concerned, the only change I can think of that might make a difference is that I edited the Launchpad snap package definition and selected stable
as the source of snapcraft, intending that this would install snapcraft 3.1 from the snap package. However, even after reverting that change in the Launchpad package definition, builds continue to fail, this time with a different error:
https://launchpadlibrarian.net/412359112/buildlog_snap_ubuntu_xenial_amd64_ldc2-1.10_BUILDING.txt.gz
Downloading 'core.snap' 100%
Build failed
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 230, in run
self.pull()
File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 195, in pull
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 497, 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-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build_url": "https://launchpad.net/~ldc-developers/+snap/ldc2-1.10/+build/471095"}', '--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/ldc2 && linux64 snapcraft pull']' returned non-zero exit status 2
Finally, I note that running a snap-package-installed snapcraft
locally (i.e. outside an LXD container) seems to work. So I can only conclude that there is some sort of issue with how snap-packaged snapcraft operates when running inside an LXD container.
Can anyone advise? :-\
Thanks & best wishes,
-- Joe