elf: add fallback methods to detect library dependencies
Metadata
Current evaluation
Merged changes implementing fallback methods to detect library dependencies when ldd fails due to libc6 mismatches. The three-step detection logic was approved by reviewers and passed CI checks before integration.
Suggested action: —
No scores available.
Issue body
libc6 may mismatch with the paths provided to ldd in LD_LIBRARY_PATH.
This may be avoided if invoking the binary directory and using
LD_TRACE_LOADED_OBJECTS, but this method is limited to executable
files.
This updates the library dependency search to try three variants:
(1) use ldd as today. if ldd fails..
(2) use ldd with LD_PRELOAD to specify libc6 from host. if ldd fails...
(3) use ld trace method. if ldd trace fails...
(4) warn as before.
For #2, libc6 is expected as /lib/<arch-triplet>/libc.so.6. This likely
will need to be more robust in the future.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged changes implementing fallback methods to detect library dependencies when ldd fails due to libc6 mismatches. The three-step detection logic was approved by reviewers and passed CI checks before integration. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Adds fallback methods to detect ELF library dependencies when ldd fails due to libc6 or LD_LIBRARY_PATH mismatches. Implements a three-step fallback chain before warning. Approved and merged with full coverage. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2746 elf: handle missing dependencies not found on system | snapcraft | merged | Merged updates to handle missing ELF dependencies when ldd fails to resolve them. The change prevents filtering unresolved libraries, refactors ldd parsing for reliability, and adds unit tests. Approved by one reviewer and passed CI checks. |