4 ms·
For Gleam//Erlang is there an easy way to package up an executable you can distribute without also shipping Erlang?
by 0cf8612b2e1e 1y ago
For Gleam//Erlang is there an easy way to package up an executable you can distribute without also shipping Erlang?
- WJW 1y agoYou can compile to javascript as well.
- lpil 1y agoNo, the VM needs to be installed on the machine, similar to C#, Java, Python, etc. There have been some projects for creating self-extracting executable archives for the VM, and some projects for compiling BEAM programs to native code, but nothing has become well established yet.
- vips7L 1y agoI think C# has been able to compile the vm + your DLL into a single binary that doesn’t extract for a while now. There’s currently ongoing work for Java to do this.
- lpil 1y agoYes, for sure. Both the JVM and the CLR have some native binary compilation options that, while less popular, are certainly suitable for production. The similar project for the BEAM unfortunately stalled and is no longer being developed.
- jdiff 1y agoYes, I've created single-file Gleam executables by compiling to JavaScript and then using Node's experimental SEA (single executable application) feature. As a bonus, typically I've found the JavaScript targets to run a good deal faster for number-crunching tasks.
- 0cf8612b2e1e 1y agoHow big is a hello world executable in that case?
- jdiff 1y agoHefty. The process is effectively just injecting all of the JS into the Node interpreter executable, so it's the size of the interpreter plus whatever you stuff inside. It's close to 50MB.
- 0cf8612b2e1e 1y agoOof, well that’s not ideal.
- totalperspectiv 1y agoI can't speak to Gleam, but for Elixir I just used Burrito to create a single executable: https://github.com/burrito-elixir/burrito https://github.com/burrito-elixir/burrito I think it works for just Erlang too.
- toast0 1y agoI haven't used it, but from the docs, I don't see why this wouldn't work for any language that compiles to beam files. You might need to adjust the build setup a bit. Personally, I think I'd prefer something that worked without unpacking, but I don't actually need something like this, so my preferences aren't super important :D