I've been trying to generate an AppImage for a Rust program, on Linux. Notes:
-
There's a Cargo tool for this: cargo appimage. It creates a single executable file which mounts a file system containing everything in the package.
-
It needs "appimagetool" pre-installed somewhere on the current $PATH. That's not packaged with the Cargo tool, and it's not a standard Ubuntu application. So it has to be downloaded from here. You get to pick a version: "pre-release", from 2023, or "13", from 2020. When you download it, you get an AppImage file, named something like " appimagetool-x86_64.AppImage ".
-
cargo appimage wants "appimagetool" to be named "appimagetool", so you have to rename or link the above file.
-
cargo appimage has to be called with the current directory set to the root directory for the executable you want to package, not the workspace root if you have a workspace. Failure to do this gets useful error messages: "os error 2: File not found".
-
You get to specify a list of directories to be copied into the packaged distribution. Those are specified relative to the root directory for the executable you want to package. They go into the package relative to its root, which may or may not be what you want. There's no option to specify a different source and destination. So you have to lay out your directories accordingly.
-
The executable to be run is placed in "usr/bin/bin" in the packaged file system. The executable file is actually called bin, and that's probably what you're going to see at the top of its window. The executable file needs to know to look for its assets relative to "../.." from the location of the executable.
-
When it builds the AppImage file, it places it in the root directory of the project that generates the executable. Not in the target subtree. It knows to look for the executable in the target subtree, so it understands Cargo file layout. It just isn't consistent with it.
It seems to be possible to get this to work, but it wants certain files in specific directories, ones not entirely consistent with usual Cargo layout. This is a headache if you already have an existing project. If it just put the executable in the root directory of its file system, had enough smarts to find "appimagetool" by itself, and reported errors better, it would be more usable.
Is AppImage used much?