pkgconfig files end up with double `/root/stage` in prefix
Metadata
Current evaluation
Fixed by snapcraft PR #3848 (commit 2dadaa6da), which removes staged-snap prefixes from .pc files; the reporter confirmed that Snapcraft 7.1.1 on stable fixes it.
Resolution: closed resolved
Reason: PR #3848 was merged as commit 2dadaa6da, updating pkg-config handling to remove prefixes from staged snaps' .pc files. The reporter confirmed on 2022-08-04 that Snapcraft 7.1.1 on stable resolved the issue.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Hey *crafters, it looks like Snapcraft mangles .pc files a bit too eagerly:
$ grep ^prefix stage/usr/lib/x86_64-linux-gnu/pkgconfig/miral.pc
prefix=/root/stage/root/stage/usr
It seems to add /root/stage when snapping, and then again when unpacking the build-snap…
<Chris Patterson> @Saviq I think I see how that can happen. we probably need to fix https://github.com/snapcore/snapcraft/blob/master/snapcraft/internal/repo/_base.py#L331 to make sure it's not already rewritten.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by snapcraft PR #3848 (commit 2dadaa6da), which removes staged-snap prefixes from .pc files; the reporter confirmed that Snapcraft 7.1.1 on stable fixes it. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #3848 (commit 2dadaa6da): repo: fix_pkg_config now strips existing build-stage prefixes from staged snaps' .pc files, preventing doubled paths like /root/stage/root/stage. Landed in snapcraft 7.1/7.1.1. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged snapcraft#3848 (commit 2dadaa6da) with companion craft-parts#251 (359d377a), removing prepended build-stage paths and preventing doubled /root/stage values. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after a maintainer identified a fix in _base.py to prevent double rewriting of the /root/stage prefix in pkgconfig files during snap packaging. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed with a suggested fix in base.py to prevent double path rewriting. No resolution or follow-up PR was recorded, indicating the issue was abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. A fix was identified in repo/_base.py to prevent double prefix rewriting in pkgconfig files during Snapcraft builds. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed. A maintainer identified the root cause and suggested fixing _base.py to prevent double path rewriting in pkgconfig prefix paths. No pull request or explicit resolution was provided. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcore/snapcraft#3848
(confidence 99%)
Merged as commit 2dadaa6da with the matching staged-snap pkg-config prefix fix.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3848 repo: fix_pkg_config removes prefixes from staged snap's .pc files. | snapcraft | merged | Merged in snapcraft#3848 as commit 2dadaa6da, fixing fix_pkg_config to remove build-stage prefixes from staged snaps' pkg-config .pc files. | |
| #251 repo: fix_pkg_config removes prefixes from staged snap's .pc files. | craft-parts | merged | Merged in craft-parts#251 via 7c8140f4 (commit 359d377a), stripping staged build paths from .pc prefixes before applying the new prefix, addressing LP #1916281. | |
| #1604472 snapcraft changing pkgconfig .pc prefix is creating conflicts between parts | snapcraft (launchpad) | closed | Resolved conflicting pkg-config prefix rewriting through snapcore/snapcraft PR #676, which a maintainer linked as the issue's resolution. | |
| #1774254 Wrong prefix is set in staged pkg-config files when alternate --prefix is configured | snapcraft (launchpad) | closed | Fixed incorrect prefix in staged pkg-config files when alternate --prefix is configured. Resolved via snapcraft#3848 and craft-parts#251. | |
| #5158 Snapcraft doesn't honor ${pcfiledir} in pkgconfig files | snapcraft | closed | Fixed ${pcfiledir} handling via snapcraft#5157 (0a7f753ac) for Core20/Core22 and craft-parts#977 (b4a09d95) for Core24+. | |
| #1983009 Snapcraft 7.1.0 fails to find stage package when cross-compiling | snapcraft (launchpad) | closed | Fixed by canonical/snapcraft#3416 (commit 8f418e3d9), restoring core20 behavior so stage packages come from build-on repositories during cross-compilation. |