Anyone know why snapcraft changes the prefix
of a staged pkg-config file to $SNAPCRAFT_STAGE$originally_configured_prefix_dir
? The new prefix doesn’t seem to be correct at all…
$ cat stage/lib/pkgconfig/hunspell.pc
prefix=/home/ubuntu/poedit/stage/snap/poedit/current
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: hunspell
Description: Hunspell spellchecking library
Version: 1.3.4
Libs: -L${libdir} -lhunspell-1.3
Cflags: -I${includedir}/hunspell
This might be a side effect of setting --prefix
, is that what you are doing? The reason for this, when --prefix
is not set, is that pkconfig has no concept of multiple SYSROOTs so they get massaged so that they find the right path, it seems that it isn’t working particularly well with the build system/configuration you are using though. Mind logging a bug on https://launchpad.net/snapcraft/+filebug for this?
As a workaround, in snapcraft.yaml
you can try something like,
parts:
part:
override-stage: |
snapcraftctl stage
sed -i '$SNAPCRAFT_STAGE/lib/pkgconfig/hunspell.pc -e "s/^prefix=.*$/prefix=$SNAPCRAFT_STAGE/"
Fix prefix to whatever is correct.
2 Likes
Yes I’m currently trying to fix an issue possibly due to a non-relocatable part and thus setting the --prefix
, I’ve using the same workaround for now. Thanks!