Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make an Erlang app release on a Mac to run it on Linux?

Tags:

erlang

Are releases cross-platform so that I can build a release on one platform, and run it as it is on another or should I build on the same platform on which I am going to run the app?

like image 416
Sergei Basharov Avatar asked Sep 18 '25 21:09

Sergei Basharov


2 Answers

Releases mechanism requires at least additional work to be made to make it cross-platform

While Erlang beams are cross-platform, releases usually contain additional data that can be platform dependent.

It is

  • Erts itself.
  • Platform dependent libraries

If you want to build release for Linux at Mac, you'll at least will need Erts build for Linux. If you are using relx, for example, you'll have to specify it with

{include_erts, "/path/to/erlang"},
{system_libs, "/path/to/erlang"},

Additional platform-dependent libraries is a different story. Almost every complicated Erlang application use some NIFs or Ports, that are usually come with release and sit in privs. If you use any, you'll have to cross-compile them for your target platform. You'll have to handle it by yourself probably

like image 109
Lol4t0 Avatar answered Sep 23 '25 05:09

Lol4t0


Provided that those platforms have same OTP version: Yes .beam files should be compatible across platforms because it's the Erlang VM that interprets the bytecode. Just like .class files and JVM.

For platforms with different versions, it's backwards compatible with 2 major releases. Means if you made a release on a OS X machine with R16B, it should be compatible to any machines running OTP 17 and 18. Source

Both cases however doesn't apply to compiled native code or NIFs.

like image 31
Ruel Avatar answered Sep 23 '25 06:09

Ruel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!