Build to AppImage

Hello everyone.

My name is Giuliano, I’m new on discuss, but it’s a while I am interested in Ocaml and I built some little projects (hobbistic level) on my own using this language, but even if I am not a noob, I am far to be an expert.

I work almost entirely on Linux, and I was wondering if someone has considered building AppImages for linux (just the “final executable”) (no cross compliation)

In my opinion there will be some benefits: despite the bigger size, we’ll have some executable that can be shipped to linux machines at the price of a copy.
Obviously not all scenarios will benefit from this, but if I need to build a micro service, and I don’t have the possibility to go with docker/kubernetes/whatever are the other names, I can provide an AppImage and that will be my distribution.

Any ideas or suggestions on where can I start?
Or tell me if my approach is wrong and there are better solutions.

Thanks in advance
Giuliano

4 Likes

Hi Giuliano and welcome!

I haven’t tried AppImage, but I just want to mention that it’s possible to build statically-linked binaries for linux, from OCaml/C/C++ source. The (relatively) easy way to build this is with musl as the libc implementation instead of glibc, in an Alpine container. Alpine comes nicely set up for this.

Dune-deps is a simple ocaml application that can be used as an example of static linking. The base docker image used there is built with ocaml-layer.

5 Likes

I will try it.
I did not thought about static binaries.

Thanks Martin