Wrong prefix is set in staged pkg-config files when alternate --prefix is configured
Metadata
Current evaluation
Fixed incorrect prefix in staged pkg-config files when alternate --prefix is configured. Resolved via snapcraft#3848 and craft-parts#251.
Resolution: closed resolved
Reason: The issue was fixed by merging PR #3848 in snapcraft and PR #251 in craft-parts, which corrected the prefix variable handling in staged pkg-config files.
Evaluated by: mr-cal-bot
No scores available.
Issue body
The prefix variable of the pkg-config file is currently changed to `$SNAPCRAFT_STAGE$originally_configured_prefix_dir` by snapcraft when staging, and the value is not valid.
```
$ 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
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | closed resolved | Fixed incorrect prefix in staged pkg-config files when alternate --prefix is configured. Resolved via snapcraft#3848 and craft-parts#251. | |
| stealth/space-bunny-alpha |
Impact:
32
Quick Win:
6
Complexity:
55
Confidence:
74
Actionability:
45
|
close resolved | 2018 report that snapcraft rewrote staged pkg-config .pc `prefix` to $SNAPCRAFT_STAGE/<prefix>, producing invalid values with an alternate part prefix. Uncommented, untriaged; 8.7 release notes now state prefix is no longer modified for relocatable .pc files. | |
| stealth/space-bunny-alpha |
Impact:
48
Quick Win:
30
Complexity:
35
Confidence:
99
Actionability:
95
|
close resolved | Staged pkg-config files received invalid prefixes with an alternate --prefix; Snapcraft 8.7 now preserves prefixes in relocatable .pc files. | |
| qwen/qwen3.6-35b-a3b |
Impact:
30
Quick Win:
14
Complexity:
40
Confidence:
90
Actionability:
80
|
close resolved | Wrong prefix in staged pkg-config files when alternate --prefix is configured. Fixed in snapcraft 8.7 via PR #5157 which stops modifying prefix for relocatable .pc files. | |
| qwen/qwen3.8-27b |
Impact:
40
Quick Win:
18
Staleness:
90
Complexity:
55
Confidence:
55
Support Request:
5
|
needs triage | Staged .pc files get prefix rewritten to $SNAPCRAFT_STAGE plus the original configure prefix, producing invalid paths when an alternate --prefix was used. Open since 2018, no labels or comments; pkg-config prefix handling has since been reworked in the codebase. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
45
Confidence:
90
Support Request:
10
|
close stale | Bug report detailing incorrect prefix paths in staged pkg-config files when using alternate --prefix. Unlabeled, zero comments, inactive for over eight years. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
95
Complexity:
55
Confidence:
85
Support Request:
5
|
close stale | Snapcraft incorrectly sets the prefix in staged pkg-config files when an alternate --prefix is used, resulting in invalid paths. Untriaged and inactive for over 8 years. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
45
Confidence:
85
Support Request:
10
|
close stale | Bug report from 8 years ago detailing incorrect prefix substitution in staged pkg-config files when using an alternate --prefix. No maintainer interaction or activity. |
Update history
| Date | Change |
|---|---|
| closed | |
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#3848
(confidence 95%)
Directly fixes the pkg-config prefix issue in snapcraft
-
Likely Fixed By:
canonical/craft-parts#251
(confidence 95%)
Related fix in craft-parts that addresses the underlying prefix handling
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #620 Alter prefix for pkg-config to get correct values | snapcraft | merged | Merged in snapcraft#620 as commit f25abf9c0, correcting pkg-config prefixes so reported values resolve correctly during builds. | |
| #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. | |
| #1916281 pkgconfig files end up with double `/root/stage` in prefix | snapcraft (launchpad) | closed | 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. | |
| #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. |