Making a minimal distributable program in Erlang.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Making a minimal distributable program in Erlang.

Joe Armstrong-2
Hello,

I want to ship Erlang as a component inside a
larger application to run on Windows

Assuming the larger application has reserved space
for Erlang at some destination directory $DEST then I need
to copy a subset of the files from a standard
distribution into $DEST.

On a Mac I have reduced the number of necessary files to 11
(could be 10 if you remove start.script)

├── COPYRIGHT
├── bin
│   ├── beam.smp
│   ├── erl_child_setup
│   ├── erlexec
│   ├── start.boot
│   └── start.script
├── erl
└── lib
    ├── compiler-7.0.2.ez
    ├── kernel-5.1.ez
    ├── sasl-3.0.1.ez
    └── stdlib-3.1.ez

I've thrown away all the libraries apart from compiler etc.

I'm trying (unsuccessfully) to do the same thing on windows - does anybody
know how to make a minimal Erlang for windows? - which files must be
copied and which files must be patched????

As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux.

I was thinking along the lines of running the program twice - in run one
I'd trace all calls to discover which modules were actually called, then
from this information build a minimal distributable program.

Cheers

/Joe
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Stu Bailey
"As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux."

Joe,

It would be nice if Erlang had an official Docker image (e.g. https://docs.docker.com/docker-for-windows/ ).  Such an image would fulfill exactly your requirement. Here are the official Docker images for other languagesl:


I guess this is the start:


Note this work:


Stu

On Wed, Sep 20, 2017 at 3:22 AM, Joe Armstrong <[hidden email]> wrote:
Hello,

I want to ship Erlang as a component inside a
larger application to run on Windows

Assuming the larger application has reserved space
for Erlang at some destination directory $DEST then I need
to copy a subset of the files from a standard
distribution into $DEST.

On a Mac I have reduced the number of necessary files to 11
(could be 10 if you remove start.script)

├── COPYRIGHT
├── bin
│   ├── beam.smp
│   ├── erl_child_setup
│   ├── erlexec
│   ├── start.boot
│   └── start.script
├── erl
└── lib
    ├── compiler-7.0.2.ez
    ├── kernel-5.1.ez
    ├── sasl-3.0.1.ez
    └── stdlib-3.1.ez

I've thrown away all the libraries apart from compiler etc.

I'm trying (unsuccessfully) to do the same thing on windows - does anybody
know how to make a minimal Erlang for windows? - which files must be
copied and which files must be patched????

As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux.

I was thinking along the lines of running the program twice - in run one
I'd trace all calls to discover which modules were actually called, then
from this information build a minimal distributable program.

Cheers

/Joe
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Ali Sabil

On Wed, Sep 20, 2017 at 12:35 PM, Stu Bailey <[hidden email]> wrote:
"As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux."

Joe,

It would be nice if Erlang had an official Docker image (e.g. https://docs.docker.com/docker-for-windows/ ).  Such an image would fulfill exactly your requirement. Here are the official Docker images for other languagesl:


I guess this is the start:


Note this work:


Stu

On Wed, Sep 20, 2017 at 3:22 AM, Joe Armstrong <[hidden email]> wrote:
Hello,

I want to ship Erlang as a component inside a
larger application to run on Windows

Assuming the larger application has reserved space
for Erlang at some destination directory $DEST then I need
to copy a subset of the files from a standard
distribution into $DEST.

On a Mac I have reduced the number of necessary files to 11
(could be 10 if you remove start.script)

├── COPYRIGHT
├── bin
│   ├── beam.smp
│   ├── erl_child_setup
│   ├── erlexec
│   ├── start.boot
│   └── start.script
├── erl
└── lib
    ├── compiler-7.0.2.ez
    ├── kernel-5.1.ez
    ├── sasl-3.0.1.ez
    └── stdlib-3.1.ez

I've thrown away all the libraries apart from compiler etc.

I'm trying (unsuccessfully) to do the same thing on windows - does anybody
know how to make a minimal Erlang for windows? - which files must be
copied and which files must be patched????

As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux.

I was thinking along the lines of running the program twice - in run one
I'd trace all calls to discover which modules were actually called, then
from this information build a minimal distributable program.

Cheers

/Joe
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Stu Bailey
:-) Yes like that! :-)  Awesome

On Wed, Sep 20, 2017 at 3:40 AM, Ali Sabil <[hidden email]> wrote:

On Wed, Sep 20, 2017 at 12:35 PM, Stu Bailey <[hidden email]> wrote:
"As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux."

Joe,

It would be nice if Erlang had an official Docker image (e.g. https://docs.docker.com/docker-for-windows/ ).  Such an image would fulfill exactly your requirement. Here are the official Docker images for other languagesl:


I guess this is the start:


Note this work:


Stu

On Wed, Sep 20, 2017 at 3:22 AM, Joe Armstrong <[hidden email]> wrote:
Hello,

I want to ship Erlang as a component inside a
larger application to run on Windows

Assuming the larger application has reserved space
for Erlang at some destination directory $DEST then I need
to copy a subset of the files from a standard
distribution into $DEST.

On a Mac I have reduced the number of necessary files to 11
(could be 10 if you remove start.script)

├── COPYRIGHT
├── bin
│   ├── beam.smp
│   ├── erl_child_setup
│   ├── erlexec
│   ├── start.boot
│   └── start.script
├── erl
└── lib
    ├── compiler-7.0.2.ez
    ├── kernel-5.1.ez
    ├── sasl-3.0.1.ez
    └── stdlib-3.1.ez

I've thrown away all the libraries apart from compiler etc.

I'm trying (unsuccessfully) to do the same thing on windows - does anybody
know how to make a minimal Erlang for windows? - which files must be
copied and which files must be patched????

As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux.

I was thinking along the lines of running the program twice - in run one
I'd trace all calls to discover which modules were actually called, then
from this information build a minimal distributable program.

Cheers

/Joe
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions




_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
In reply to this post by Stu Bailey
On Wed, Sep 20, 2017 at 12:35 PM, Stu Bailey <[hidden email]> wrote:
> "As an afterthought - it would be *very nice* to have a program which
> makes a minimal distributable program for Windows/Mac/Linux."
>
> Joe,
>
> It would be nice if Erlang had an official Docker image (e.g.
> https://docs.docker.com/docker-for-windows/ ).  Such an image would fulfill
> exactly your requirement.

I think this is a separate issue (though a good idea for Erlang developers)

In my use case we are targeting nieve
windows users who won't have Docker installed

> Here are the official Docker images for other
> languagesl:
>
> https://hub.docker.com/_/python/
> https://hub.docker.com/_/golang/
> https://hub.docker.com/_/rust/
> https://hub.docker.com/_/clojure/
> https://hub.docker.com/_/java/
>
> I guess this is the start:
>
> https://github.com/erlang/docker-erlang
>
> Note this work:
>
> https://store.docker.com/community/images/library/rabbitmq
>
> Stu
>
> On Wed, Sep 20, 2017 at 3:22 AM, Joe Armstrong <[hidden email]> wrote:
>>
>> Hello,
>>
>> I want to ship Erlang as a component inside a
>> larger application to run on Windows
>>
>> Assuming the larger application has reserved space
>> for Erlang at some destination directory $DEST then I need
>> to copy a subset of the files from a standard
>> distribution into $DEST.
>>
>> On a Mac I have reduced the number of necessary files to 11
>> (could be 10 if you remove start.script)
>>
>> ├── COPYRIGHT
>> ├── bin
>> │   ├── beam.smp
>> │   ├── erl_child_setup
>> │   ├── erlexec
>> │   ├── start.boot
>> │   └── start.script
>> ├── erl
>> └── lib
>>     ├── compiler-7.0.2.ez
>>     ├── kernel-5.1.ez
>>     ├── sasl-3.0.1.ez
>>     └── stdlib-3.1.ez
>>
>> I've thrown away all the libraries apart from compiler etc.
>>
>> I'm trying (unsuccessfully) to do the same thing on windows - does anybody
>> know how to make a minimal Erlang for windows? - which files must be
>> copied and which files must be patched????
>>
>> As an afterthought - it would be *very nice* to have a program which
>> makes a minimal distributable program for Windows/Mac/Linux.
>>
>> I was thinking along the lines of running the program twice - in run one
>> I'd trace all calls to discover which modules were actually called, then
>> from this information build a minimal distributable program.
>>
>> Cheers
>>
>> /Joe
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Matthias Lang
In reply to this post by Joe Armstrong-2
On 20. September 2017, Joe Armstrong wrote:

> I was thinking along the lines of running the program twice - in run one
> I'd trace all calls to discover which modules were actually called, then
> from this information build a minimal distributable program.

code:all_loaded() is an easy way to see which modules were loaded by
a particular run of a program.

What's harder is being confident that your program won't call further
modules when given different input. A pragmatic approach is to run a
test suite with 'sufficient' coverage.

Matthias
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

zxq9-2
In reply to this post by Joe Armstrong-2
On 2017年09月20日 水曜日 12:46:00 Joe Armstrong wrote:

> On Wed, Sep 20, 2017 at 12:35 PM, Stu Bailey <[hidden email]> wrote:
> > "As an afterthought - it would be *very nice* to have a program which
> > makes a minimal distributable program for Windows/Mac/Linux."
> >
> > Joe,
> >
> > It would be nice if Erlang had an official Docker image (e.g.
> > https://docs.docker.com/docker-for-windows/ ).  Such an image would fulfill
> > exactly your requirement.
>
> I think this is a separate issue (though a good idea for Erlang developers)
>
> In my use case we are targeting nieve
> windows users who won't have Docker installed

This. The world doesn't revolve around Docker.

<sigh/>

-Craig
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Vlad Dumitrescu-2
In reply to this post by Joe Armstrong-2
Hi Joe,
I got it started by adding the erts-9.0/bin directory and editing the bin/erl.ini file with the right path. Am trying to trim more, but my PC is acting weird.
Regards,
Vlad


On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
Hello,

I want to ship Erlang as a component inside a
larger application to run on Windows

Assuming the larger application has reserved space
for Erlang at some destination directory $DEST then I need
to copy a subset of the files from a standard
distribution into $DEST.

On a Mac I have reduced the number of necessary files to 11
(could be 10 if you remove start.script)

├── COPYRIGHT
├── bin
│   ├── beam.smp
│   ├── erl_child_setup
│   ├── erlexec
│   ├── start.boot
│   └── start.script
├── erl
└── lib
    ├── compiler-7.0.2.ez
    ├── kernel-5.1.ez
    ├── sasl-3.0.1.ez
    └── stdlib-3.1.ez

I've thrown away all the libraries apart from compiler etc.

I'm trying (unsuccessfully) to do the same thing on windows - does anybody
know how to make a minimal Erlang for windows? - which files must be
copied and which files must be patched????

As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux.

I was thinking along the lines of running the program twice - in run one
I'd trace all calls to discover which modules were actually called, then
from this information build a minimal distributable program.

Cheers

/Joe
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
This is what I tried - actually even if it works you might accidentally
be picking up files from the original C:/Program Files/erl ... directory.

I looked at the Wings3D distribution - this has managed to hide away
a complete erlang - but how it finds the correct directories to load the
libraries from is a mystery to me

/Joe

On Wed, Sep 20, 2017 at 1:15 PM, Vlad Dumitrescu <[hidden email]> wrote:

> Hi Joe,
> I got it started by adding the erts-9.0/bin directory and editing the
> bin/erl.ini file with the right path. Am trying to trim more, but my PC is
> acting weird.
> Regards,
> Vlad
>
>
> On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
>>
>> Hello,
>>
>> I want to ship Erlang as a component inside a
>> larger application to run on Windows
>>
>> Assuming the larger application has reserved space
>> for Erlang at some destination directory $DEST then I need
>> to copy a subset of the files from a standard
>> distribution into $DEST.
>>
>> On a Mac I have reduced the number of necessary files to 11
>> (could be 10 if you remove start.script)
>>
>> ├── COPYRIGHT
>> ├── bin
>> │   ├── beam.smp
>> │   ├── erl_child_setup
>> │   ├── erlexec
>> │   ├── start.boot
>> │   └── start.script
>> ├── erl
>> └── lib
>>     ├── compiler-7.0.2.ez
>>     ├── kernel-5.1.ez
>>     ├── sasl-3.0.1.ez
>>     └── stdlib-3.1.ez
>>
>> I've thrown away all the libraries apart from compiler etc.
>>
>> I'm trying (unsuccessfully) to do the same thing on windows - does anybody
>> know how to make a minimal Erlang for windows? - which files must be
>> copied and which files must be patched????
>>
>> As an afterthought - it would be *very nice* to have a program which
>> makes a minimal distributable program for Windows/Mac/Linux.
>>
>> I was thinking along the lines of running the program twice - in run one
>> I'd trace all calls to discover which modules were actually called, then
>> from this information build a minimal distributable program.
>>
>> Cheers
>>
>> /Joe
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Sergej Jurečko
In reply to this post by Vlad Dumitrescu-2
You can just delete the erl.ini file. That way the erl/werl will work no matter where you put the top level erlang folder. 
You can definitely also delete:
- all .pdb files
- all  *.debug.*.dll
- all .lib files
- all source (.c, .h, .erl, .hrl) files

A simple filelib:wildcard comprehension with delete across erl folder will achieve this quickly.

Regards,
Sergek

On 20 Sep 2017, at 13:15, Vlad Dumitrescu <[hidden email]> wrote:

Hi Joe,
I got it started by adding the erts-9.0/bin directory and editing the bin/erl.ini file with the right path. Am trying to trim more, but my PC is acting weird.
Regards,
Vlad


On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
Hello,

I want to ship Erlang as a component inside a
larger application to run on Windows

Assuming the larger application has reserved space
for Erlang at some destination directory $DEST then I need
to copy a subset of the files from a standard
distribution into $DEST.

On a Mac I have reduced the number of necessary files to 11
(could be 10 if you remove start.script)

├── COPYRIGHT
├── bin
│   ├── beam.smp
│   ├── erl_child_setup
│   ├── erlexec
│   ├── start.boot
│   └── start.script
├── erl
└── lib
    ├── compiler-7.0.2.ez
    ├── kernel-5.1.ez
    ├── sasl-3.0.1.ez
    └── stdlib-3.1.ez

I've thrown away all the libraries apart from compiler etc.

I'm trying (unsuccessfully) to do the same thing on windows - does anybody
know how to make a minimal Erlang for windows? - which files must be
copied and which files must be patched????

As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux.

I was thinking along the lines of running the program twice - in run one
I'd trace all calls to discover which modules were actually called, then
from this information build a minimal distributable program.

Cheers

/Joe
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
In reply to this post by Vlad Dumitrescu-2
Making some progress - I have copied *everything* from the erlang
distribution to my new location and edited erl.ini - the system now seems to
start correctly from the new location.

Now I need to start deleting things, until I discover I've deleted too much and
broken it - if somebody knows which files I have to keep it would be a great
help :-)

/Joe


On Wed, Sep 20, 2017 at 1:15 PM, Vlad Dumitrescu <[hidden email]> wrote:

> Hi Joe,
> I got it started by adding the erts-9.0/bin directory and editing the
> bin/erl.ini file with the right path. Am trying to trim more, but my PC is
> acting weird.
> Regards,
> Vlad
>
>
> On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
>>
>> Hello,
>>
>> I want to ship Erlang as a component inside a
>> larger application to run on Windows
>>
>> Assuming the larger application has reserved space
>> for Erlang at some destination directory $DEST then I need
>> to copy a subset of the files from a standard
>> distribution into $DEST.
>>
>> On a Mac I have reduced the number of necessary files to 11
>> (could be 10 if you remove start.script)
>>
>> ├── COPYRIGHT
>> ├── bin
>> │   ├── beam.smp
>> │   ├── erl_child_setup
>> │   ├── erlexec
>> │   ├── start.boot
>> │   └── start.script
>> ├── erl
>> └── lib
>>     ├── compiler-7.0.2.ez
>>     ├── kernel-5.1.ez
>>     ├── sasl-3.0.1.ez
>>     └── stdlib-3.1.ez
>>
>> I've thrown away all the libraries apart from compiler etc.
>>
>> I'm trying (unsuccessfully) to do the same thing on windows - does anybody
>> know how to make a minimal Erlang for windows? - which files must be
>> copied and which files must be patched????
>>
>> As an afterthought - it would be *very nice* to have a program which
>> makes a minimal distributable program for Windows/Mac/Linux.
>>
>> I was thinking along the lines of running the program twice - in run one
>> I'd trace all calls to discover which modules were actually called, then
>> from this information build a minimal distributable program.
>>
>> Cheers
>>
>> /Joe
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
In reply to this post by Sergej Jurečko
On Wed, Sep 20, 2017 at 1:28 PM, Sergej Jurečko
<[hidden email]> wrote:
> You can just delete the erl.ini file. That way the erl/werl will work no
> matter where you put the top level erlang folder.

Yes - it worked - But how does erl.exe find the dll's ??



> You can definitely also delete:
> - all .pdb files
> - all  *.debug.*.dll
> - all .lib files
> - all source (.c, .h, .erl, .hrl) files

How much of the bin directories do I have to keep?

I just want erlang with networking and a shell no distribution -


/Joe

>
> A simple filelib:wildcard comprehension with delete across erl folder will
> achieve this quickly.
>
> Regards,
> Sergek
>
>
> On 20 Sep 2017, at 13:15, Vlad Dumitrescu <[hidden email]> wrote:
>
> Hi Joe,
> I got it started by adding the erts-9.0/bin directory and editing the
> bin/erl.ini file with the right path. Am trying to trim more, but my PC is
> acting weird.
> Regards,
> Vlad
>
>
> On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
>>
>> Hello,
>>
>> I want to ship Erlang as a component inside a
>> larger application to run on Windows
>>
>> Assuming the larger application has reserved space
>> for Erlang at some destination directory $DEST then I need
>> to copy a subset of the files from a standard
>> distribution into $DEST.
>>
>> On a Mac I have reduced the number of necessary files to 11
>> (could be 10 if you remove start.script)
>>
>> ├── COPYRIGHT
>> ├── bin
>> │   ├── beam.smp
>> │   ├── erl_child_setup
>> │   ├── erlexec
>> │   ├── start.boot
>> │   └── start.script
>> ├── erl
>> └── lib
>>     ├── compiler-7.0.2.ez
>>     ├── kernel-5.1.ez
>>     ├── sasl-3.0.1.ez
>>     └── stdlib-3.1.ez
>>
>> I've thrown away all the libraries apart from compiler etc.
>>
>> I'm trying (unsuccessfully) to do the same thing on windows - does anybody
>> know how to make a minimal Erlang for windows? - which files must be
>> copied and which files must be patched????
>>
>> As an afterthought - it would be *very nice* to have a program which
>> makes a minimal distributable program for Windows/Mac/Linux.
>>
>> I was thinking along the lines of running the program twice - in run one
>> I'd trace all calls to discover which modules were actually called, then
>> from this information build a minimal distributable program.
>>
>> Cheers
>>
>> /Joe
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
Seems like I need to keep

  erl.exe
  start.boot
  beam.smp.dll
  erlexec.dll

And throw the rest away - seems to work (so far) - does anybody know If I've
thrown  way too much

/Joe


On Wed, Sep 20, 2017 at 1:51 PM, Joe Armstrong <[hidden email]> wrote:

> On Wed, Sep 20, 2017 at 1:28 PM, Sergej Jurečko
> <[hidden email]> wrote:
>> You can just delete the erl.ini file. That way the erl/werl will work no
>> matter where you put the top level erlang folder.
>
> Yes - it worked - But how does erl.exe find the dll's ??
>
>
>
>> You can definitely also delete:
>> - all .pdb files
>> - all  *.debug.*.dll
>> - all .lib files
>> - all source (.c, .h, .erl, .hrl) files
>
> How much of the bin directories do I have to keep?
>
> I just want erlang with networking and a shell no distribution -
>
>
> /Joe
>>
>> A simple filelib:wildcard comprehension with delete across erl folder will
>> achieve this quickly.
>>
>> Regards,
>> Sergek
>>
>>
>> On 20 Sep 2017, at 13:15, Vlad Dumitrescu <[hidden email]> wrote:
>>
>> Hi Joe,
>> I got it started by adding the erts-9.0/bin directory and editing the
>> bin/erl.ini file with the right path. Am trying to trim more, but my PC is
>> acting weird.
>> Regards,
>> Vlad
>>
>>
>> On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
>>>
>>> Hello,
>>>
>>> I want to ship Erlang as a component inside a
>>> larger application to run on Windows
>>>
>>> Assuming the larger application has reserved space
>>> for Erlang at some destination directory $DEST then I need
>>> to copy a subset of the files from a standard
>>> distribution into $DEST.
>>>
>>> On a Mac I have reduced the number of necessary files to 11
>>> (could be 10 if you remove start.script)
>>>
>>> ├── COPYRIGHT
>>> ├── bin
>>> │   ├── beam.smp
>>> │   ├── erl_child_setup
>>> │   ├── erlexec
>>> │   ├── start.boot
>>> │   └── start.script
>>> ├── erl
>>> └── lib
>>>     ├── compiler-7.0.2.ez
>>>     ├── kernel-5.1.ez
>>>     ├── sasl-3.0.1.ez
>>>     └── stdlib-3.1.ez
>>>
>>> I've thrown away all the libraries apart from compiler etc.
>>>
>>> I'm trying (unsuccessfully) to do the same thing on windows - does anybody
>>> know how to make a minimal Erlang for windows? - which files must be
>>> copied and which files must be patched????
>>>
>>> As an afterthought - it would be *very nice* to have a program which
>>> makes a minimal distributable program for Windows/Mac/Linux.
>>>
>>> I was thinking along the lines of running the program twice - in run one
>>> I'd trace all calls to discover which modules were actually called, then
>>> from this information build a minimal distributable program.
>>>
>>> Cheers
>>>
>>> /Joe
>>> _______________________________________________
>>> erlang-questions mailing list
>>> [hidden email]
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

József Bérces (LA/ETH)
Hi Joe,

Here is what I have bundled with a tool used mainly inside Ericsson:

erl
 |_ bin
 |   |_ beam.dll
 |   |_ beam.smp.dll
 |   |_ epmd.exe
 |   |_ erl.exe
 |   |_ erl.ini
 |   |_ erlexec.dll
 |   |_ erlsrv.exe
 |   |_ inet_gethost.exe
 |   |_ libeay32.dll
 |   |_ start.boot
 |_ lib
     |_ erts-8.1
         |_ ...
     |_ kernel-5.1
         |_ ...
     |_ ...

What libraries to include depends on the application's needs. You might also add MSVCR120.dll into the bin directory just in case your target users do not have it installed.

BR,
Jozsef

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Joe Armstrong
Sent: Wednesday, September 20, 2017 14:00
To: Sergej Jurečko <[hidden email]>
Cc: erlang-questions <[hidden email]>
Subject: Re: [erlang-questions] Making a minimal distributable program in Erlang.

Seems like I need to keep

  erl.exe
  start.boot
  beam.smp.dll
  erlexec.dll

And throw the rest away - seems to work (so far) - does anybody know If I've thrown  way too much

/Joe


On Wed, Sep 20, 2017 at 1:51 PM, Joe Armstrong <[hidden email]> wrote:

> On Wed, Sep 20, 2017 at 1:28 PM, Sergej Jurečko
> <[hidden email]> wrote:
>> You can just delete the erl.ini file. That way the erl/werl will work
>> no matter where you put the top level erlang folder.
>
> Yes - it worked - But how does erl.exe find the dll's ??
>
>
>
>> You can definitely also delete:
>> - all .pdb files
>> - all  *.debug.*.dll
>> - all .lib files
>> - all source (.c, .h, .erl, .hrl) files
>
> How much of the bin directories do I have to keep?
>
> I just want erlang with networking and a shell no distribution -
>
>
> /Joe
>>
>> A simple filelib:wildcard comprehension with delete across erl folder
>> will achieve this quickly.
>>
>> Regards,
>> Sergek
>>
>>
>> On 20 Sep 2017, at 13:15, Vlad Dumitrescu <[hidden email]> wrote:
>>
>> Hi Joe,
>> I got it started by adding the erts-9.0/bin directory and editing the
>> bin/erl.ini file with the right path. Am trying to trim more, but my
>> PC is acting weird.
>> Regards,
>> Vlad
>>
>>
>> On 20 Sep 2017 12:22, "Joe Armstrong" <[hidden email]> wrote:
>>>
>>> Hello,
>>>
>>> I want to ship Erlang as a component inside a larger application to
>>> run on Windows
>>>
>>> Assuming the larger application has reserved space for Erlang at
>>> some destination directory $DEST then I need to copy a subset of the
>>> files from a standard distribution into $DEST.
>>>
>>> On a Mac I have reduced the number of necessary files to 11 (could
>>> be 10 if you remove start.script)
>>>
>>> ├── COPYRIGHT
>>> ├── bin
>>> │   ├── beam.smp
>>> │   ├── erl_child_setup
>>> │   ├── erlexec
>>> │   ├── start.boot
>>> │   └── start.script
>>> ├── erl
>>> └── lib
>>>     ├── compiler-7.0.2.ez
>>>     ├── kernel-5.1.ez
>>>     ├── sasl-3.0.1.ez
>>>     └── stdlib-3.1.ez
>>>
>>> I've thrown away all the libraries apart from compiler etc.
>>>
>>> I'm trying (unsuccessfully) to do the same thing on windows - does
>>> anybody know how to make a minimal Erlang for windows? - which files
>>> must be copied and which files must be patched????
>>>
>>> As an afterthought - it would be *very nice* to have a program which
>>> makes a minimal distributable program for Windows/Mac/Linux.
>>>
>>> I was thinking along the lines of running the program twice - in run
>>> one I'd trace all calls to discover which modules were actually
>>> called, then from this information build a minimal distributable program.
>>>
>>> Cheers
>>>
>>> /Joe
>>> _______________________________________________
>>> erlang-questions mailing list
>>> [hidden email]
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Dmitry Kolesnikov-2
In reply to this post by Stu Bailey
Hello,

On 20 Sep 2017, at 13.35, Stu Bailey <[hidden email]> wrote:

"As an afterthought - it would be *very nice* to have a program which
makes a minimal distributable program for Windows/Mac/Linux."

This program is called relx.

It generates a release package which are deployable to any vanilla linux or other vanilla os. 
The usage of Docker-image-with-Erlang complicates the process of distribution.

Best Regards, 
Dmitry



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
Thanks everybody for you help - I got it down to 5.5MB in 9 files
Relocated as follows. I've also packed/compressed the libraries

Here are the files that are needed

%% DEST/bin/erl.exe                     120320 bytes
%% DEST/bin/start.boot                    5603 bytes
%% DEST/erts-9.0/bin/beam.smp.dll      3346944 bytes
%% DEST/erts-9.0/bin/erlexec.dll        162304 bytes
%% DEST/erts-9.0/bin/inet_gethost.exec   45568 bytes
%% DEST/lib/compiler-7.1.ez             409091 bytes
%% DEST/lib/kernel-5.2.ez               384730 bytes
%% DEST/lib/sasl-3.0.4.ez               106278 bytes
%% DEST/lib/stdlib-3.4.ez               913013 bytes

This seems to work :-)

Cheers

/Joe

On Wed, Sep 20, 2017 at 2:24 PM, Dmitry Kolesnikov
<[hidden email]> wrote:

> Hello,
>
> On 20 Sep 2017, at 13.35, Stu Bailey <[hidden email]> wrote:
>
> "As an afterthought - it would be *very nice* to have a program which
> makes a minimal distributable program for Windows/Mac/Linux."
>
>
> This program is called relx.
>
> It generates a release package which are deployable to any vanilla linux or
> other vanilla os.
> The usage of Docker-image-with-Erlang complicates the process of
> distribution.
>
> Best Regards,
> Dmitry
>
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Frank Muller
Do you think it's possible to package this minimal distribution in one excutable?

Imagine we can ship a whole release in one binary (like in Go).

/Frank

Wed 20 sept. 2017 at 16:23, Joe Armstrong <[hidden email]> wrote :
Thanks everybody for you help - I got it down to 5.5MB in 9 files
Relocated as follows. I've also packed/compressed the libraries

Here are the files that are needed

%% DEST/bin/erl.exe                     120320 bytes
%% DEST/bin/start.boot                    5603 bytes
%% DEST/erts-9.0/bin/beam.smp.dll      3346944 bytes
%% DEST/erts-9.0/bin/erlexec.dll        162304 bytes
%% DEST/erts-9.0/bin/inet_gethost.exec   45568 bytes
%% DEST/lib/compiler-7.1.ez             409091 bytes
%% DEST/lib/kernel-5.2.ez               384730 bytes
%% DEST/lib/sasl-3.0.4.ez               106278 bytes
%% DEST/lib/stdlib-3.4.ez               913013 bytes

This seems to work :-)

Cheers

/Joe

On Wed, Sep 20, 2017 at 2:24 PM, Dmitry Kolesnikov
<[hidden email]> wrote:
> Hello,
>
> On 20 Sep 2017, at 13.35, Stu Bailey <[hidden email]> wrote:
>
> "As an afterthought - it would be *very nice* to have a program which
> makes a minimal distributable program for Windows/Mac/Linux."
>
>
> This program is called relx.
>
> It generates a release package which are deployable to any vanilla linux or
> other vanilla os.
> The usage of Docker-image-with-Erlang complicates the process of
> distribution.
>
> Best Regards,
> Dmitry
>
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Drasko DRASKOVIC
On Wed, Sep 20, 2017 at 4:34 PM, Frank Muller
<[hidden email]> wrote:
> Do you think it's possible to package this minimal distribution in one
> excutable?
>
> Imagine we can ship a whole release in one binary (like in Go).

+1 for this because we could put it in the "FROM_SCRATCH" Docker
container and have minimal size, something like this:
https://github.com/shortishly/erlang-in-docker-from-scratch

BR,
Drasko
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Joe Armstrong-2
In reply to this post by Frank Muller
Yes^1000 I would very much like this to happen.

The windows version I put together was 5.5 MB in 9 files
The emulator is 3.5 MB and all the erlang code (compiled and compressed
a MB or so) - so realistically we could make an stand-along program in c. 5MB

Things like Hugo (static site generator in GO) are single file executables
- Hugo is massive 18MB on my machine (probably a lot of templates - who knows?)

I did an experiment a while back with self-modifing executables
Basicicall the structure of a executable is:

      Stub    3.5 MB
      Data    Len bytes
      Len      4 bytes
      Magic  4 bytes

The Stub is always the same and gets copied from app to app.
Following the sub is the program. It's just Data (compress beam code)
Then a length counter (length of Data) then a magic number.

When Stub starts it reads itself, checks there's a magic byte on the
end, if so reads the Length of the Data, then the data and then boot's itself.

(This is how PDF files work, reading backwards from the end - it's nice
because you could always daisy-chain things on the end)

How do we write Stub? - this needs "yet another top-level program to
start Erlang"
What you can't do is include the erlang DLL's in the Data area of the program
I think you have to statically link *everything* into the stub.

I don't know how squashable the object code is - it might be nice to compress
the object code for (Mac,Windows,Linux) and put them in the Data area
of the program, then decompress them and load them on-the-fly.

This kind of code goes way beyond my knowledge of the low-level code
needed to boot C applications.

I have a feeling it might not be a lot of code - but it's (really) tricky
stuff.

So my first question is - how can I compile Erlang into a single file
executable? - I want no scripts/batch files to launch erlang no DLLs
and a statically linked binary?

/Joe



On Wed, Sep 20, 2017 at 4:34 PM, Frank Muller
<[hidden email]> wrote:

> Do you think it's possible to package this minimal distribution in one
> excutable?
>
> Imagine we can ship a whole release in one binary (like in Go).
>
> /Frank
>
> Wed 20 sept. 2017 at 16:23, Joe Armstrong <[hidden email]> wrote :
>>
>> Thanks everybody for you help - I got it down to 5.5MB in 9 files
>> Relocated as follows. I've also packed/compressed the libraries
>>
>> Here are the files that are needed
>>
>> %% DEST/bin/erl.exe                     120320 bytes
>> %% DEST/bin/start.boot                    5603 bytes
>> %% DEST/erts-9.0/bin/beam.smp.dll      3346944 bytes
>> %% DEST/erts-9.0/bin/erlexec.dll        162304 bytes
>> %% DEST/erts-9.0/bin/inet_gethost.exec   45568 bytes
>> %% DEST/lib/compiler-7.1.ez             409091 bytes
>> %% DEST/lib/kernel-5.2.ez               384730 bytes
>> %% DEST/lib/sasl-3.0.4.ez               106278 bytes
>> %% DEST/lib/stdlib-3.4.ez               913013 bytes
>>
>> This seems to work :-)
>>
>> Cheers
>>
>> /Joe
>>
>> On Wed, Sep 20, 2017 at 2:24 PM, Dmitry Kolesnikov
>> <[hidden email]> wrote:
>> > Hello,
>> >
>> > On 20 Sep 2017, at 13.35, Stu Bailey <[hidden email]> wrote:
>> >
>> > "As an afterthought - it would be *very nice* to have a program which
>> > makes a minimal distributable program for Windows/Mac/Linux."
>> >
>> >
>> > This program is called relx.
>> >
>> > It generates a release package which are deployable to any vanilla linux
>> > or
>> > other vanilla os.
>> > The usage of Docker-image-with-Erlang complicates the process of
>> > distribution.
>> >
>> > Best Regards,
>> > Dmitry
>> >
>> >
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Making a minimal distributable program in Erlang.

Stefan Hellkvist-2

>
> So my first question is - how can I compile Erlang into a single file
> executable? - I want no scripts/batch files to launch erlang no DLLs
> and a statically linked binary?

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?

/Stefan

>
> /Joe
>
>
>
> On Wed, Sep 20, 2017 at 4:34 PM, Frank Muller
> <[hidden email]> wrote:
>> Do you think it's possible to package this minimal distribution in one
>> excutable?
>>
>> Imagine we can ship a whole release in one binary (like in Go).
>>
>> /Frank
>>
>> Wed 20 sept. 2017 at 16:23, Joe Armstrong <[hidden email]> wrote :
>>>
>>> Thanks everybody for you help - I got it down to 5.5MB in 9 files
>>> Relocated as follows. I've also packed/compressed the libraries
>>>
>>> Here are the files that are needed
>>>
>>> %% DEST/bin/erl.exe                     120320 bytes
>>> %% DEST/bin/start.boot                    5603 bytes
>>> %% DEST/erts-9.0/bin/beam.smp.dll      3346944 bytes
>>> %% DEST/erts-9.0/bin/erlexec.dll        162304 bytes
>>> %% DEST/erts-9.0/bin/inet_gethost.exec   45568 bytes
>>> %% DEST/lib/compiler-7.1.ez             409091 bytes
>>> %% DEST/lib/kernel-5.2.ez               384730 bytes
>>> %% DEST/lib/sasl-3.0.4.ez               106278 bytes
>>> %% DEST/lib/stdlib-3.4.ez               913013 bytes
>>>
>>> This seems to work :-)
>>>
>>> Cheers
>>>
>>> /Joe
>>>
>>> On Wed, Sep 20, 2017 at 2:24 PM, Dmitry Kolesnikov
>>> <[hidden email]> wrote:
>>>> Hello,
>>>>
>>>> On 20 Sep 2017, at 13.35, Stu Bailey <[hidden email]> wrote:
>>>>
>>>> "As an afterthought - it would be *very nice* to have a program which
>>>> makes a minimal distributable program for Windows/Mac/Linux."
>>>>
>>>>
>>>> This program is called relx.
>>>>
>>>> It generates a release package which are deployable to any vanilla linux
>>>> or
>>>> other vanilla os.
>>>> The usage of Docker-image-with-Erlang complicates the process of
>>>> distribution.
>>>>
>>>> Best Regards,
>>>> Dmitry
>>>>
>>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> [hidden email]
>>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
12