# Not finding correct dependencies

**URL:** <https://discourse.appimage.org/t/not-finding-correct-dependencies/113>\
**Category:** Creating AppImages\
**Created:** [December 19, 2016, 10:17pm UTC](https://discourse.appimage.org/t/not-finding-correct-dependencies/113 "2016-12-19T22:17:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkoverlordofdata](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/darkoverlordofdata/32/36_2.png) [@darkoverlordofdata](https://discourse.appimage.org/u/darkoverlordofdata)\
**Post date:** [December 19, 2016, 10:17pm UTC](https://discourse.appimage.org/t/not-finding-correct-dependencies/113/1 "2016-12-19T22:17:53Z")

</div>

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  
.DirIcon  
AppRun  
fonts  
fonts/OpenDyslexic-Bold.otf  
fonts/TitanOne-Regular.ttf  
…

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:

> <https://github.com/AppImage/AppImageKit/blob/appimagetool/master/resources/AppRun>

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?

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [December 22, 2016, 12:12pm UTC](https://discourse.appimage.org/t/not-finding-correct-dependencies/113/2 "2016-12-22T12:12:09Z")

</div>

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](http://stackoverflow.com/a/21006000/6217117)
- Binary-patch the software to not load from `/usr` as shown [here](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#manually-creating-an-appdir) (not recommended if you have the source code and can change the app)
- [BinReloc](https://github.com/limbahq/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](https://github.com/probonopd/AppImageKit/issues/267) (not recommended if you have the source code and can change the app)

See [https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages) for more information and examples.
