Skip to content

fix: expose staged runtime libraries - #97

Closed
clwsgruk wants to merge 1 commit into
candidatefrom
fix/runtime-library-path
Closed

clwsgruk wants to merge 1 commit into
candidatefrom
fix/runtime-library-path

Conversation

@clwsgruk

@clwsgruk clwsgruk commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stage libgl1 so the core22 candidate includes the required libGL.so.1
  • use CRAFT_ARCH_TRIPLET_BUILD_FOR to expose only the target architecture's staged library directories through the launcher
  • include the matching target-architecture core22 base directories so the patched base loader does not fall through to incompatible host libraries

Root cause

Store candidate revision 228, built after #96 enabled PatchELF, exits before startup with:

error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

The packed executable uses the core22 interpreter and its RUNPATH points at the snap and base, but the candidate does not contain libGL.so.1, and core22 does not provide it. Staging libgl1 supplies the library; the launcher path mirrors the working Sublime Merge fix while deriving the target multiarch triplet at build time.

Verification

  • reproduced candidate revision 228 failure: exit 127, missing libGL.so.1
  • git diff --check
  • snapcraft expand-extensions
  • snapcraft clean && snapcraft pack --use-lxd from the final signed commit
  • confirmed the packed snap contains usr/lib/x86_64-linux-gnu/libGL.so.1
  • confirmed packed launcher metadata resolves CRAFT_ARCH_TRIPLET_BUILD_FOR to x86_64-linux-gnu and contains no arm64 path in the amd64 artifact
  • installed the final local classic snap with --dangerous --classic
  • snap run sublime-text.subl --version: exit 0, Sublime Text Build 4200
  • removed the local test installation after verification

The application still emits its existing optional libcurl.so symbol-loading warnings during --version; they do not prevent startup and are outside this failure.

Review requested from @soumyaDghosh. FYI @jnsgruk.

Comment thread snap/snapcraft.yaml Outdated
Comment on lines +31 to +32
environment:
LD_LIBRARY_PATH: $SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/lib/aarch64-linux-gnu:$SNAP/usr/lib/aarch64-linux-gnu:/snap/core22/current/lib/x86_64-linux-gnu:/snap/core22/current/usr/lib/x86_64-linux-gnu:/snap/core22/current/lib/aarch64-linux-gnu:/snap/core22/current/usr/lib/aarch64-linux-gnu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be required

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was fast 😀

I just merged a similar change on sublime merge after an observed failure in CI to start the snap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though this at least needs to take into account the arch triplet

@clwsgruk
clwsgruk force-pushed the fix/runtime-library-path branch from 10d24a1 to cdfad0c Compare September 5, 2026 07:34
@clwsgruk
clwsgruk marked this pull request as ready for review September 5, 2026 07:39
@jnsgruk

jnsgruk commented Sep 5, 2026

Copy link
Copy Markdown
Member

Closing for further investigation

@jnsgruk jnsgruk closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants