Not finding correct dependencies

My appimage runs, but it’s not locating the correct dependencies. I have no idea what I’m doing wrong.
I’m using the AppRun from AppImageKit/releases.

If i list the contents, I can see these fonts:

./appimagetool-x86_64.AppImage -l ShmupWarz-x86_64.AppImage

I’m trying to probe for the font location:

defaultFont = "./fonts/OpenDyslexic-Bold.otf"
var check = File.new_for_path(defaultFont)
if !check.query_exists()
    defaultFont = "/usr/local/share/fonts/TitanOne-Regular.ttf"

print "Found font %s", defaultFont

When I run the appimage, it prints out:
Found font /usr/local/share/fonts/TitanOne-Regular.ttf

So it’s only finding the fonts in my file system, not in the appimage.


Well, the appimage documentation says to use relative paths, but they dont’seem to work. Here is what did

I took the script at:

and I changed the last line from this
exec “${EXEC}” $@

to this
exec “${EXEC}” $@ “${HERE}”

Then I modified my code to pick up the path in args[1], and calculate the absolute path:

Check /tmp/.mount_WorkYy/fonts/OpenDyslexic-Bold.otf
Found font /tmp/.mount_WorkYy/fonts/OpenDyslexic-Bold.otf

And it works, but it doesn’t seem you should have to modify your code design for appimage. This is a really kludgy solution. How is it really supposed to work?

The software inside the AppImage needs to load its resources using paths relative to itself rather than absolute paths. Some software doesn’t and simply tries to load stuff from locations inside /usr.

There are workarounds around that:

  • Change the app so that it loads resources from locations relative to itself (e.g., in Python using os.path.dirname(__file__)) as discussed here
  • Binary-patch the software to not load from /usr as shown here (not recommended if you have the source code and can change the app)
  • BinReloc library for creating relocatable software
  • You could use the environment variable $APPDIR rather than add "${HERE}" to the launcher and parsing that. The AppImage environment has $APPDIR point to the mountpoint of the AppImage
  • Use one of the LD_PRELOAD-based solutions discussed here (not recommended if you have the source code and can change the app)

See for more information and examples.