I’ve renovated your snapcraft build file, so that hopefully it’s more inline with the snappy way of building things and easier to understand.
To answer why
This part is missing libraries that cannot be satisfied ...
The answer is that compiling the libvips libraries manually means that when snapcraft does checks to help with making sure all the dynamic dependencies are bundled, it can’t quite work out what these dependencies are and hence what stage-packages to recommend because they’re locally compiled. In addition, the compiling process puts them in $SNAP/usr/local/lib
, as opposed to e.g $SNAP/lib
, which means at runtime they’re not found by default. Snapcraft sets up the $LD_LIBRARY_PATH
variable to include $SNAP/lib
automatically, so we need to add the libvips packages to this list too. That’s what the environment:
section does in the snapcraft file below, and this fixes the runtime problem. Snapcraft might continue to keep showing the warning in builds but you can safely ignore it.
But otherwise, I think your snapcraft file above is complicating things by avoiding making use of both plugins and parts. By using the nil plugin you get the advantage of controlling the entire build manually, but lack the niceities of e.g setting up $DESTDIR
automatically, a default set of build-packages
, etc.
Logically, libvips and tifig are two seperate parts, with two seperate sources, and two seperate build toolchains. They’re linked in that one needs to be built first and exposed to the other to compile against, snapcraft solves this with the after:
keyword, which ensures libvips is compiled first and then it’s made available for tifig to build against.
Otherwise, I’ve taken the liberty of knocking the base to core20
just to get the newer compiler tools and push back having to worry about rebasing in the future by another 2 years. And I’ve changed the version tag from git
to '1'
since git didn’t make sense to me, but you can set it back to git if it makes sense for you.
Unfortunately, I don’t have the time to work out why tifig
keeps putting its build files in $SNAPCRAFT_PART_BUILD
, but since it’s just the one single binary that’s produced, I use build-override
to copy it into $SNAPCRAFT_PART_INSTALL
manually. There might be something in the CMake files that’s interfering, but I’m not a CMake expert.
So feel free to try this file, run snapcraft clean
before snapcraft
to make sure the build environment is nice and tidy, and hopefully the resulting snap should work for you.
name: tifig
version: '1'
summary: Converts HEIF images created on iOS 11 devices as fast as possible.
description: |
Tifig converts HEIF images created on iOS 11 devices as fast as humanly possible.
base: core20
confinement: strict
license: MIT
grade: stable
parts:
tifig:
plugin: cmake
source: https://github.com/monostream/tifig.git
build-packages:
- libavcodec-dev
- libswscale-dev
- wget
- gtk-doc-tools
- gobject-introspection
- libtool
stage-packages:
- libaom0
- libavcodec58
- libavutil56
- libcairo-gobject2
- libcairo2
- libcodec2-0.9
- libdatrie1
- libdrm2
- libfontconfig1
- libfreetype6
- libfribidi0
- libgdk-pixbuf2.0-0
- libgomp1
- libgraphite2-3
- libgsm1
- libharfbuzz0b
- libicu66
- libmp3lame0
- libnuma1
- libogg0
- libopenjp2-7
- libopus0
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libpixman-1-0
- librsvg2-2
- libshine3
- libsnappy1v5
- libsoxr0
- libspeex1
- libswresample3
- libswscale5
- libthai0
- libtheora0
- libtwolame0
- libva-drm2
- libva-x11-2
- libva2
- libvdpau1
- libvorbis0a
- libvorbisenc2
- libvpx6
- libwavpack1
- libwebpmux3
- libx11-6
- libx264-155
- libx265-179
- libxau6
- libxcb-render0
- libxcb-shm0
- libxcb1
- libxdmcp6
- libxext6
- libxfixes3
- libxml2
- libxrender1
- libxvidcore4
- libzvbi0
- ocl-icd-libopencl1
override-build: |
snapcraftctl build
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp $SNAPCRAFT_PART_BUILD/tifig $SNAPCRAFT_PART_INSTALL/bin/tifig
after: [libvips]
libvips:
plugin: autotools
source: https://github.com/jcupitt/libvips/archive/refs/tags/v8.6.1.tar.gz
build-packages:
- libglib2.0-dev
- libexpat1-dev
- libjpeg-dev
- libexif-dev
- libpng-dev
- libtiff-dev
stage-packages:
- libexif12
- libjbig0
- libjpeg-turbo8
- libpng16-16
- libtiff5
apps:
tifig:
command: bin/tifig
environment:
LD_LIBRARY_PATH: $SNAP/usr/local/lib
plugs:
- home
You might need to add some more interfaces to fix sandboxing, and maybe there’s a need for some other modifications if e.g it opens any desktop windows or the like, but this should at least build, install, and actually make the tifig
binary available to the system.