Skip to content

Commit

Permalink
snapcraft.yaml: unset LD_FLAGS and LD_LIBRARY_PATH to allow iterative…
Browse files Browse the repository at this point in the history
… builds

Leaving these set leads to the debian build system including files from
$SNAPCRAFT_STAGE in the build and using those libraries, etc. which it should
not be doing. Without this, after building successfully once, re-building the
snap without cleaning would fail like this:

dpkg-shlibdeps: error: no dependency information found for /root/stage/lib/x86_64-linux-gnu/libc.so.6 (used by debian/snapd/usr/lib/snapd/snap-seccomp)
Hint: check if the library actually comes from a package.
dh_shlibdeps: dpkg-shlibdeps -Tdebian/snapd.substvars debian/snapd/usr/bin/snapfuse debian/snapd/usr/bin/snap debian/snapd/usr/lib/snapd/snap-confine debian/snapd/usr/lib/snapd/snap-seccomp debian/snapd/usr/lib/snapd/snap-bootstrap debian/snapd/usr/lib/snapd/snap-gdb-shim debian/snapd/usr/lib/snapd/snap-repair debian/snapd/usr/lib/snapd/snapd debian/snapd/usr/lib/snapd/snap-failure debian/snapd/usr/lib/snapd/snap-discard-ns debian/snapd/usr/lib/systemd/system-environment-generators/snapd-env-generator debian/snapd/lib/systemd/system-generators/snapd-generator returned exit code 2
debian/rules:102: recipe for target 'binary' failed
make: *** [binary] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2
Failed to run 'override-build': Exit code was 2.

because libc.so.6 was included in the linker search path during compiling when
it should just be using the one from the build environment instead.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
  • Loading branch information
anonymouse64 committed Feb 10, 2020
1 parent 61b4ec6 commit 4180ba3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build-aux/snap/snapcraft.yaml
Expand Up @@ -41,6 +41,13 @@ parts:
# set version after installing dependencies so we have all the tools here
snapcraftctl set-version $(./mkversion.sh --output-only)
override-build: |
# unset the LD_FLAGS and LD_LIBRARY_PATH vars that snapcraft sets for us
# as those will point to the $SNAPCRAFT_STAGE which on re-builds will
# contain things like libc and friends that confuse the debian package
# build system
# TODO: should we unset $PATH to not include $SNAPCRAFT_STAGE too?
unset LD_FLAGS
unset LD_LIBRARY_PATH
# if we are root, disable tests
if [ "$(id -u)" = "0" ]; then
DEB_BUILD_OPTIONS=nocheck
Expand Down

0 comments on commit 4180ba3

Please sign in to comment.