snapcraft should setup search paths/flags for parts built after parts
Metadata
Current evaluation
Fixed pkg-config dependency discovery by using the shared stage directory for parts linked with after:, resolving build isolation failures.
Resolution: closed resolved
Reason: The reporter confirmed that libtirpc was detected after the maintainer corrected PKG_CONFIG_SYSROOT_DIR to use the stage directory. The resulting pkg-config handling was reworked in commit 4a5de243e.
Evaluated by: mr-cal-bot
No scores available.
Issue body
When building multiple parts from source that depend on each other in a snapcraft session it would be useful if snapcraft would setup the environment for each part in a way that autotools/pkg-config/cmake can find the build results from 'after:'-parts.
Or instead of setting up search paths it might just build & install in a dedicated chroot environment and build each part in the same environment..
Assume this snapcraft.yaml:
name: nfs-server # the name of the snap
version: 0.1 # the version of the snap
# The vendor for the snap (replace 'Vendor <email address hidden>')
vendor: Andreas Pokorny <email address hidden>
summary: Simple NFS Server
description: Simple NFS Server setup for home server use, with manual user and exports setup
icon: folder-remote-nfs.png
architectures: [armhf]
parts:
libtirpc:
plugin: autotools
source: git://github.com/APokorny/libtirpc.git
source-branch: use-snappy-env
stage-packages:
- libkrb5-dev
filesets:
tir-files:
- lib/libtirpc.so*
snap:
- $tir-files
rpcbind:
plugin: autotools
source: git://git.linux-nfs.org/projects/steved/rpcbind.git
stage-packages:
- libwrap0-dev
after:
- libtirpc
nfs-utils:
plugin: autotools
source: git://github.com/APokorny/nfs-utils.git
source-branch: use-snappy-env
stage-packages:
- libcomerr2
- libnfsidmap2
after:
- libtirpc
After building libtirpc when building rpcbind configure fails because it cannot find libtirpc. The configure script uses pkg-config here. I assume snapcraft would use PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR.
...
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed pkg-config dependency discovery by using the shared stage directory for parts linked with after:, resolving build isolation failures. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed cross-part source-build discovery by reworking pkg-config/library collection and using the shared stagedir; merged in snapcore/snapcraft#335 (854431f4b). | |
| stealth/space-bunny-alpha | — | closed stale | Closed without a documented fix, linked PR, or maintainer explanation after nearly 11 years of inactivity; implementing the requested after-part build environment was not confirmed. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The request to auto-configure search paths for dependent parts was abandoned. Later snapcraft updates added native environment propagation and part dependency handling, rendering the feature obsolete. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without comments or resolution. The requested automatic environment setup was later implemented in subsequent snapcraft releases, superseding this issue. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without implementation or comments. The request to automatically configure search paths for dependent parts was abandoned. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1541620 snapcraft can't find modules installed under 'stage' dir | snapcraft (launchpad) | closed | Closed as invalid after maintainers could not reproduce the problem across repeated clean builds; separate pkg-config support for build-packages was mentioned. |