<div dir="ltr"><div>I think one of the reasons for the directory structure has to do with hot-code-upgrades. It is way easier if your system is able to load stuff individually from files rather than having to work with static binaries.<br><br></div>Static binaries would be nice. But a full implementation must also be able to load patches into the binary later on, if you decide to upgrade the running code. This may not be that simple to pull off, though ELF can do tricks.<br><br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 21, 2017 at 1:15 PM Frank Muller <<a href="mailto:frank.muller.erl@gmail.com">frank.muller.erl@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">Stefan,</div><div dir="auto"><br></div><div dir="auto">By statically linking bins, Joe is talking about the executables here (erl.exe, ...), not the beam files IMHO.</div><div dir="auto"><br></div><div dir="auto">You'll be able to reload your beam modules on the fly, obviously.</div><div dir="auto"><br></div><div dir="auto">Moreover, nothing prevent a statically built executable to load a shared lib while running.</div><div dir="auto"><br></div><div dir="auto">@Joe: just made a quick search and found UPX binary packer. It's cross-platform:</div><div dir="auto"><a href="https://upx.github.io/" target="_blank">https://upx.github.io/</a></div><div dir="auto"><br></div><div dir="auto">Can you please try to shrink the minimal VM binaries on Windows and report back the new size?</div><div dir="auto">Use: upx.exe -9 ...</div></div><div><div dir="auto"><br></div><div dir="auto">/Frank</div></div><div><br><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
><br>
> So my first question is - how can I compile Erlang into a single file<br>
> executable? - I want no scripts/batch files to launch erlang no DLLs<br>
> and a statically linked binary?<br>
<br>
Getting rid of scripts/batch files you can do if you generalize the erlexec binary a bit (in Docker for instance, as it was mentioned before, you perhaps want to be able to configure more things with environment variables for instance) but what would "statically linked" mean in the world of modules that load shared objects and even modules that can be upgraded? To statically link one would have to sacrifice the dynamic code reload, right?<br>
<br>
/Stefan<br>
<br>
><br>
> /Joe<br>
><br>
><br>
><br>
> On Wed, Sep 20, 2017 at 4:34 PM, Frank Muller<br>
> <<a href="mailto:frank.muller.erl@gmail.com" target="_blank">frank.muller.erl@gmail.com</a>> wrote:<br>
>> Do you think it's possible to package this minimal distribution in one<br>
>> excutable?<br>
>><br>
>> Imagine we can ship a whole release in one binary (like in Go).<br>
>><br>
>> /Frank<br>
>><br>
>> Wed 20 sept. 2017 at 16:23, Joe Armstrong <<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>> wrote :<br>
>>><br>
>>> Thanks everybody for you help - I got it down to 5.5MB in 9 files<br>
>>> Relocated as follows. I've also packed/compressed the libraries<br>
>>><br>
>>> Here are the files that are needed<br>
>>><br>
>>> %% DEST/bin/erl.exe 120320 bytes<br>
>>> %% DEST/bin/start.boot 5603 bytes<br>
>>> %% DEST/erts-9.0/bin/beam.smp.dll 3346944 bytes<br>
>>> %% DEST/erts-9.0/bin/erlexec.dll 162304 bytes<br>
>>> %% DEST/erts-9.0/bin/inet_gethost.exec 45568 bytes<br>
>>> %% DEST/lib/compiler-7.1.ez 409091 bytes<br>
>>> %% DEST/lib/kernel-5.2.ez 384730 bytes<br>
>>> %% DEST/lib/sasl-3.0.4.ez 106278 bytes<br>
>>> %% DEST/lib/stdlib-3.4.ez 913013 bytes<br>
>>><br>
>>> This seems to work :-)<br>
>>><br>
>>> Cheers<br>
>>><br>
>>> /Joe<br>
>>><br>
>>> On Wed, Sep 20, 2017 at 2:24 PM, Dmitry Kolesnikov<br>
>>> <<a href="mailto:dmkolesnikov@gmail.com" target="_blank">dmkolesnikov@gmail.com</a>> wrote:<br>
>>>> Hello,<br>
>>>><br>
>>>> On 20 Sep 2017, at 13.35, Stu Bailey <<a href="mailto:stu.bailey@gmail.com" target="_blank">stu.bailey@gmail.com</a>> wrote:<br>
>>>><br>
>>>> "As an afterthought - it would be *very nice* to have a program which<br>
>>>> makes a minimal distributable program for Windows/Mac/Linux."<br>
>>>><br>
>>>><br>
>>>> This program is called relx.<br>
>>>><br>
>>>> It generates a release package which are deployable to any vanilla linux<br>
>>>> or<br>
>>>> other vanilla os.<br>
>>>> The usage of Docker-image-with-Erlang complicates the process of<br>
>>>> distribution.<br>
>>>><br>
>>>> Best Regards,<br>
>>>> Dmitry<br>
>>>><br>
>>>><br>
>>> _______________________________________________<br>
>>> erlang-questions mailing list<br>
>>> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>