James Stanley


The world's stupidest AppImage

Tue 18 February 2025
Tagged: software

AppImage packages an application and its dependencies into a single file. You can then just execute that single file, and it will extract everything into a temporary directory and hook everything up so that the application works. Very easy to use, very convenient. Unfortunately, it's not so straightforward to make an AppImage.

That's where my project comes in.

I've been trying to make some changes to FreeCAD recently, and as part of that I've been building FreeCAD inside a distrobox so as not to clutter up my main filesystem with FreeCAD's extensive build dependencies.

However I found that once I had compiled the binary, it didn't work properly when running inside the distrobox. The GUI would load up, but anything involving a 3d display just didn't appear.

I suspected that the distrobox environment didn't have access to the GPU, so I tried executing the FreeCAD binary from the "host" environment, but it didn't even start up because of all the missing dependencies.

host$ bin/FreeCAD
bin/FreeCAD: error while loading shared libraries: libCoin.so.80c: cannot open shared object file: No such file or directory

So instead I got ChatGPT to write me "the world's stupidest AppImage builder". It is a shell script that copies your binary, its dynamically-linked dependencies according to ldd, and any additional files you specify, into a single self-extracting shell script. You can then execute the shell script from the host system, and it extracts the binary and all of its dependencies into a temporary directory, and then launches the binary with LD_LIBRARY_PATH set to the temporary directory.

The script is here in case you want to play with it: https://gist.github.com/jes/543669252b2951e961614e2f2a873b22.

And then I can make my FreeCAD "lame AppImage" by:

distrobox$ ./make-lame-appimage.sh bin/FreeCAD Mod Ext share src lib
Packaging FreeCAD into FreeCAD.run...
Including additional file: Mod
Including additional file: Ext
Including additional file: share
Including additional file: src
Including additional file: lib
Finding shared libraries...
Created FreeCAD.run. You can run it anywhere!

And launch it in the host environment:

host$ ./FreeCAD.run 
Extracting to /tmp/tmp.K7pLbc9g9Q...
FreeCAD 1.1.0, Libs: 1.1.0devRUnknown
(C) 2001-2025 FreeCAD contributors
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
[...]

And this time it actually loads up instead of complaining about missing libraries!

Not a total success however, because there are extra libraries that it tries to load at runtime so it doesn't totally work.

But I wanted to share the stupid AppImage-like builder anyway.

(A better solution for running FreeCAD inside a distrobox with an NVidia GPU is to create the distrobox with --nvidia, and that worked for me).



If you like my blog, please consider subscribing to the RSS feed or the mailing list: