How should I set Distillery include_erts in Windows 10

I am using distillery 1.5.2 and trying to build a release on Windows 10.

where werl.exe
C:\ProgramData\chocolatey\bin\werl.exe

rel/config.exs includes …

environment :win64 do
  set include_erts: "C:\ProgramData\chocolatey\bin"
  set include_src: false
end 

mix release --env=win64

Generated myAppName app                                                      
==> Assembling release..                                                  
==> Building release neuron:1.0.1 using environment win64                 
==> Multiple errors detected:                                             
                                                                          
- Invalid ERTS: missing erts-* directory:                                 
    Please check the path you provided to the `include_erts` option.      
- Invalid ERTS: missing bin directory                                     
    The path you provided to `include_erts` does not contain              
    `erts-*/bin`, please confirm the path is correct.                     
- Invalid ERTS: missing lib directory                                     
    The path you provided to `include_erts` does not contain              
    `erts-*/lib`, please confirm the path is correct.                     

Directory of C:\ProgramData\chocolatey\bin


08/30/2017  04:14 PM           143,496 choco.exe
08/30/2017  04:14 PM           143,496 chocolatey.exe
08/30/2017  04:14 PM           143,496 cinst.exe
08/30/2017  04:14 PM           143,496 clist.exe
08/30/2017  04:14 PM           143,496 cpack.exe
08/30/2017  04:14 PM           143,496 cpush.exe
08/30/2017  04:14 PM           143,496 cuninst.exe
08/30/2017  04:14 PM           143,496 cup.exe
08/30/2017  04:14 PM           143,496 cver.exe
12/08/2017  06:28 AM           121,856 erl.exe
08/30/2017  04:14 PM             2,283 RefreshEnv.cmd
12/08/2017  06:28 AM           121,856 werl.exe

So, the question is, for this to work …

How should I set Distillery include_erts in Windows 10 ???

And P.S.
Are there any guide to using distillery in Win10? I can’t find any documentation on this.

1 Like

Just a quick guess, escape the backslash in the path or use forward slashes

2 Likes

I just pushed a commit to master which fixes some bugs in the WIndows script as well, it should be going out in a release today I hope.

You don’t necessarily need to include ERTS either, as long as you have Erlang installed and available on the PATH exposed to the service; but it depends on what else you are running on that machine (if you have multiple releases, you may want to run different ERTS between them).

2 Likes

Thanks for the thought, but I actually did double slash in the file. They got escaped-out when I posted them. I just updated that in the question text (with four slashes :-0) So that at least should be clearer.

I think part of the issue is that distillery is expecting a directory structure like erts-*/bin but chocolatey just dumps an exe file: werl.exe

1 Like

You could mark them as codeblocks, either by indending them by 4 spaces or by wrapping them in 3-backticks-only lines:

your stuff

1 Like

Well, this is probably more chocolatey related then distillery, but probably you need to put the pass to the erlang installation, not the path to chocolateys binstub folder.

Chocolatey adds this folder to not need to append to the PATH for every program you install, since in windows the PATH is limited to a max size of 1k or 4k depending on your version of windows…

1 Like

Thanks!
This is now working on Windows 10 with the following settings:

rel/config.exs

environment :win10 do
  set include_erts: true
  set include_src: false
  set cookie: :"blah-blah"
end

mix.exs

  defp deps do
    [
      {:distillery, git: "https://github.com/bitwalker/distillery.git", branch: "master"}, 
     # ...
    ]

and running

  mix release --env=win10

I do get a runtime dialog box saying that “MSVCR120.dll is missing”
So my particular hex package requirements will however require me to install the the Visual C++ Redistributable Packages before I run my Elixir app.

1 Like

I was just able to get this to run without installing the Visual C++ Redistributable Packages. I ran into the same problem described above, MSVCR120.dll not found.

The workaround was to grab MSVCR120.dll from a Windows VM where the C++ Packages had been installed (by the elixir installer). On the bare system where I was installing my distillery release, I copied the dll into <path to release>/erts-9.2/bin, and the service was able to start.

Maybe on Windows distillery should ship the dll with erts? Or maybe there could be a separate configuration option to do so? I’m not sure if this would cause a license conflict… at the very least, this could be added somewhere in the documentation, though I’m not sure where the best place would be.

Except the Microsoft Visual C Runtimes need to be installed systemwide. ‘Sometimes’ you can put them in the same directory, but you cannot trust that to always work.

@OvermindDL1 Okay, that’s good to know. Thanks!

Maybe documentation is the answer. It might be helpful to have a Windows section in the Getting Started guide, like there is for systemd. There are some things that we’re discovering behave differently in Win 10 than on Linux or our Darwin workstations, and having a checklist of gotchas as well as some descriptions of why things are different on different platforms might save discovery time for other people.

Thanks again!

1 Like