Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Last active December 31, 2024 20:02
Show Gist options
  • Save lidgnulinux/3cab5819353d710c933d4551f1ff8fe2 to your computer and use it in GitHub Desktop.
Save lidgnulinux/3cab5819353d710c933d4551f1ff8fe2 to your computer and use it in GitHub Desktop.
Create Appimage File using Minimal Rootfs Archive Musl Distro (e.g alpine linux).

Create Appimage Using Minimal Rootfs Archive Musl Distro.

What do we need / prerequisite ?

  • Rootfs archive musl distro, I'm using alpine minirootfs archive. We can get it here.
  • AppRun executable, it's needed for launch our app. Get it here.
  • Appimagetool, available here
  • Desktop file / .desktop.
  • Icon file.

Steps.

These are some steps I do to make appimage :

  1. Download and unpack alpine minirootfs archive.

    $ mkdir nvim.Appdir     # cause I want to make neovim appimage, feel free to adjust
    $ cd nvim.Appdir
    $ wget -c https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-minirootfs-3.19.4-x86_64.tar.gz 
    $ tar -xf alpine-minirootfs-3.19.4-x86_64.tar.gz 
    
  2. Download the Apprun executable.

    $ cd nvim.Appdir
    $ wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64 -O AppRun
    $ chmod a+x AppRun
    
  3. Make a desktop file and copy icon file.

    We need a desktop file and icon file.

    [Desktop Entry]
    Type=Application
    Name=nvim
    Exec=nvim
    Icon=nvim
    Categories=Utility;TextEditor;
    Keywords=Text;editor;
    Comment=Edit text files
    

    Get your favourite icon and copy it.

    $ cp nvim.svg nvim.Appdir/nvim.svg 
    
  4. Install your desired application, for me it's neovim.

    $ cd nvim.Appdir
    $ sudo chroot . /sbin/apk update
    $ sudo chroot . /sbin/apk upgrade
    $ sudo chroot . /sbin/apk add neovim 
    
  5. Generate the appimage using appimagetool.

    $ cd nvim.Appdir
    $ cd ..
    $ appimagetool-x86_64.AppImage -v -n ./nvim.Appdir
    

    The generated appimage file will be named nvim-x86_64.AppImage. Almost forget, make sure you're online, because it will retrieve some stuffs from github.

  6. Test the appimage.

    Just run it from terminal to see if it works or not. Make sure you make symbolic link for ld-linux-x86-64.so.2 from /lib/ld-musl-x86_64.so.1 or your appimage won't work.

    $ sudo ln -s /lib/ld-musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
    $ chmod +x nvim-x86_64.AppImage 
    $ ./nvim-x86_64.AppImage
    
@lidgnulinux
Copy link
Author

For neovim v0.10.x , we need to copy lpeg.so library to our system. Simply extracting the appimage and then copy the library from ./squashfs-root/usr/lib/lua/5.1/lpeg.so to /usr/lib/lua/5.1/lpeg.so .

@lidgnulinux
Copy link
Author

For Inkscape build, to fix missing icons and unchangable icons, we can set / export these two env variables.

export GDK_PIXBUF_MODULEDIR=/usr/lib64/gdk-pixbuf-2.0/2.10.0/loaders
export GDK_PIXBUF_MODULE_FILE=/usr/lib64/gdk-pixbuf-2.0/2.10.0/loaders.cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment