Cross platform elixir releases with docker or buritto?

Hi everyone, I had built a tool that I distribute using elixir releases however recently my colleague faced an issue while running it

The release for the tool is currently built on ubuntu 20.4, when a user attempted to use it on ubuntu 18.0 it gave an error like

../csv2sqk_web/erts-12.0.3/bin/beam.smp: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory`

From what I understand…

It seems the shared library libtinfo.so.6 might not be available on ubuntu-18.0.

Also, I read

Elixir release won’t just depend on your OS flavor. Instead, an Elixir release depends on your processor architecture and C library version (glibc package). This is because there are still system dependencies in place even though Erlang bytecode is platform-independent.

I want to support different operating systems like Linux, windows, and mac and the release should run independently of the user’s processor architecture.

Till now I have found two ways to achieve this:

  1. Use docker to build the release for different platforms and operating systems - We can have a docker setup that builds the release for all the different operating systems that we want to target, however, I am not sure if this can bypass the Target architecture limitation, also I am not sure how it will work out for windows-based docker containers(I don’t have any experience with this).

  2. The second approach is using something like buritto which uses bakeware

The tool here is an umbrella application with 2 apps - one a plain elixir app, the other is a phoenix app and there are no NIFs used.

  • Any ideas on which approach seems more viable? Is there any other way to deal with this problem?

  • What targets should I think about supporting if I want to add support for Linux, Mac, and windows?

  • Any help regarding a sample docker file to build releases for different targets would be very helpful.(I am currently just planning to edit this docker file to support building for multiple targets)?

  • Any help on using buritto which uses bakeware?

  • In the future, I want to be able to test the app in Github actions for different targets, any idea on this?

(Side note: I had previously asked this question here but had given up since I did not face any complaints due to this until now.)

Thanks for reading till the end, this forum’s always been a life savior for me :pray:

3 Likes

Burrito doesn’t use bakeware. They’re two similar but completely separate projects. Burrito handles cross compilation where bakeware does not. Burrito docs are great so you shouldn’t need much else to get started there.

You can look at bakeware’s GitHub actions to see how they test multiple OSes.

Recently, Burrito was modified to accept a custom build pipeline, which I use to build releases instead of a single binary. You can see my WIP here.

You might want to build for different operating systems in your CI/CD pipeline.

6 Likes

Thanks a lot for replying.

Burrito doesn’t use bakeware.

Yup, thanks for clarifying.

look at bakeware’s GitHub actions

This is very useful thanks.

You might want to build for different operating systems in your CI/CD pipeline

I have some confusion regarding this, I tried using burrito and it worked however I still had the error error while loading shared libraries: libtinfo.so.6: cannot open shared object file when running on ubuntu-18.04.

From what I understand buritto helps us to build a release for different environments like Linux, macOS and windows however I still need to build to release for different Linux distributions and versions, for example, I have to build the release for both ubuntu 20.4 and ubuntu 18.04 since they are using different shared libraries like libtinfo.so.6 is not available for ubuntu-18.04.

So, this means I will probably have to write a separate docker script that does a mix release for every Linux distribution and version I want to support like a separate docker file to build release for ubuntu 20.04, ubuntu 18.0, etc.

So buritto only helps me to build releases for macOS or windows from a Linux machine but it does not help if the shared libraries are different.

If the above understanding is correct, then this looks like a difficult task to accomplish since I am not sure how many releases I need to build, and which distributions I need to support.

Do you know of any resources which can help me get started on this?

1 Like

UPDATE:

I tried to build the release inside a docker container running Ubuntu 18.0.
After copying the releases to my host machine running Ubuntu 20.04 it still seemed to work fine.

So it looks like a release built on ubuntu 20.04 will fail when to run on ubuntu 18.04 due to the shared library issue however trying the opposite works fine.

2 Likes