Attempting to upgrade from core22 to core24 but getting a library not found error due to having to override LD_LIBRARY_PATH

Hello, I am attempting to upgrade this snap from core22 to core24 (see WIP branch), but I’m getting this error when testing the main command within the snap in my GitHub Actions workflow after successfully building the snap image:

sudo snap install --devmode --dangerous ronin_2.0.5_amd64.snap
ronin --help
/snap/ronin/x1/usr/bin/ruby: error while loading shared libraries: libruby-3.2.so.3.2: cannot open shared object file: No such file or directory

This is likely due to the fact that I had to override LD_LIBRARY_PATH in order to force the ruby, git, and man packages to look for their shared library files within the snap image. After testing the ubuntu:24.04 docker image just to determine where ruby-3.2.so.3.2 was installed and adding ${SNAP}/lib/${SNAP_ARCH_TRIPLET} to LD_LIBRARY_PATH the error still persists.

The reason for upgrading from core22 to core24 is to gain access to a version of ruby >= 3.1.0, so that I can build snap images for my upcoming 2.1.0 release which requires ruby >= 3.1.0; and core22 only provides ruby version 3.0.x.

https://github.com/ronin-rb/snap/pull/7

Does that change actually fix the problem? Also is the fix removing the HOME override or the LD_LIBRARY_PATH override?

Yes it fixes that. Instead of overriding HOME, just change the source-code to get the path from the SNAP_REAL_HOME variable incase of snap. Because of mainly this issue.

Unfortunately, I cannot change the source code since there are too many instances where it uses HOME, plus the source code is ruby itself, rubygems, and the other ruby gems I install via https://rubygems.org/ into the snap image. Overriding HOME to use SNAP_REAL_HOME is a more pragmatic solution.

Also, I’m curious why setting HOME to SNAP_REAL_HOME would cause ruby to not find /lib/x86_64-linux-gnu/libruby-3.2.so.3.2? Those two things seem unrelated.

Yeah, those two are unrelated.

Do you have any linter errors?

Do you have the failing snap published on a channel branch?

If solving this does not happen anytime soon and you have the time, seems like an interesting problem to tackle during the ANN: Starcraft Clinics, last one was Starcraft Clinic 2024-Jun-21

There are only three unrelated linter warnings about other unused libraries. It’s failing to install locally, which is a sanity check for the built snap. https://github.com/ronin-rb/snap/actions/runs/9639400996/job/26581519276

I’ll add the upcoming Starcraft Clinic to my calendar.