Need a way to set LD_LIBRARY_PATH
Metadata
Current evaluation
Closed as obsolete: current snapd supports setting top-level LD_LIBRARY_PATH to $SNAP/lib and expands snap variables correctly.
Resolution: closed not a bug
Reason: In the 2018-01-04 closing comment, mvo demonstrated that current snapd correctly expanded LD_LIBRARY_PATH: $SNAP/lib using snap run --shell. No Snapcraft PR or commit was cited; the reported wrapper failure no longer applied to current snapd.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I can't come up with a reasonable way to set LD_LIBRARY_PATH to include additional locations.
In the yaml, I tried
environment:
LD_LIBRARY_PATH: lib/storage-framework/provider
But, when running the corresponding binary, this results in:
/snap/storage-framework/x1/command-storage-framework-registry.wrapper: 5: export: :/snap/storage-framework/x1/lib:/snap/storage-framework/x1/usr/lib:/snap/storage-framework/x1/usr/lib/x86_64-linux-gnu: bad variable name
Interestingly, this works:
environment:
FOO: BAR
I don't know what's special about LD_LIBRARY_PATH in this context.
I worked around the problem by using a script that sets LD_LIBRARY_PATH before running the binaries. But that has it's own set of problems:
- It's a round-about way of achieving something that should be dead simple
- We have the snapcraft-generated wrapper script, which then calls my script. My script calls desktop-launch (because we use ubuntu-app-platform), which then execs the real binary. That's *three* shells being forked/exec'd to start a process!
It would be *really*, *really* nice to be able to just set LD_LIBRARY_PATH directly from the yaml.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | Closed as obsolete: current snapd supports setting top-level LD_LIBRARY_PATH to $SNAP/lib and expands snap variables correctly. | |
| stealth/space-bunny-alpha | — | closed not a bug | Already works with current snapd; set top-level `environment: LD_LIBRARY_PATH: $SNAP/lib` to expand snap variables correctly. | |
| stealth/space-bunny-alpha | — | closed stale | Closed after years of inactivity with no documented fix or linked implementation for setting LD_LIBRARY_PATH through snapcraft.yaml. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution due to inactivity. The reported snapcraft.yaml environment block limitation for LD_LIBRARY_PATH remains unresolved. No fixes or official workarounds were implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution or comments. The request to directly set LD_LIBRARY_PATH via YAML environment variables was not implemented and the issue appears abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The snapcraft yaml limitation preventing direct LD_LIBRARY_PATH configuration remains unresolved, requiring manual wrapper scripts as a workaround. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution or comments. Direct YAML support for LD_LIBRARY_PATH remains unsupported, leaving users to rely on wrapper script workarounds. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1486623 LD_LIBRARY_PATH hardcoded at snap creation time -- RPATH | snapcraft (launchpad) | closed | Hardcoded LD_LIBRARY_PATH behavior was declared obsolete: a maintainer said in 2023 that it no longer applies to core22; discussion had moved to canonical/snapcraft#38. | |
| #2128 project_loader: stop setting LD_LIBRARY_PATH | snapcraft | closed | Closed unmerged in #2128 as unnecessary after the last known Trusty classic-snap user moved to Xenial; no code was changed. | |
| #2011842 Incorrect default LD_LIBRARY_PATH | snapcraft (launchpad) | open | Core22+ Snapcraft emits unsupported shell expansion for LD_LIBRARY_PATH; the behavior is reproduced and remains blocked on snapd environment-list support. | |
| #1975498 PATH/LD_LIBRARY_PATH not set in snapcraft 7.0 | snapcraft (launchpad) | closed | PATH/LD_LIBRARY_PATH regression in core22 snaps was fixed by PR #3758, merged as 6e8835dc8 and released in Snapcraft 7.1. |