How to use a library bundled in an AppImage

I’m looking at an AppImage for an application that has proven very difficult to build from source. But I don’t want to use the application itself, I want to use its libraries. So, here are a series of questions about doing this with AppImage.

Is there a way for one AppImage to include or be based on another AppImage?

Is there a way for something outside of an AppImage to link to libraries inside an AppImage?

Can I include extra files in the AppImage on the fly?
Can I change the command to run on the fly? yes
These last two questions are based on my experience with flatpak: With flatpak, I could use --filesystem to include a python script in the flatpak, and then --command to execute my script instead of the default binary. That script could then import the python libraries that are only distributed in the flatpak. Is there something similar with AppImage?

2 Likes

Hey, i got the same problem, do you solve it ?
Thanks baptiste

This could be done but it’s incredibly hacky and goes against the idea of keeping things as simple as possible (one app = one file). I think a more realistic option would be to extract the AppImage you need the libraries from (run it with ‘–appimage-extract’ on the command line), then copy the needed files out of squashfs-root.

If you DO want to require another AppImage as a dependency, which should only be used as a learning exercise or personal use and never be distributed, you will need to find its SquashFS offset, which can be done with ‘–appimage-offset’, or if you want to do it without executing the AppImage, you can look at the get_sfs_offset function of one of my projects (GitHub - mgord9518/shappimage: An AppImage implementation made in shell script) as a reference on how to do this in Bourne shell. After the offset is found, you can mount it using the program squashfuse with ‘-o offset=…’, then access it as if it’s a normal read-only directory.

No. Don’t do this. 1 app = 1 file.

Is there a way for one AppImage to include or be based on another AppImage?

Can I include extra files in the AppImage on the fly?

Yes.

Extract the existing AppImage to an AppDir, deploy the binary you want to add to the AppDir (including its dependencies), convert the AppDir to an AppImage again.