How to setup to build on windows?

I’ve spent a couple of hours trying to get everything together (VS, Ruby, Rustler, CMake, Erlang :+1::crossed_fingers:) but having issues locating / installing Elixir.

I think 1.14 is recommended, not sure if any particular OTP version is important, but even after grabbing choco just to install a version , am not sure if the install is still running.

cancelled and retried elevated with choco install elixir --force

After several failed win-build-all attempts, I eventually sourced and built mix and added to machine path so build run from elevated prompt succeeded, and produced an .exe, which actually works :astonished: … but I suspect I have gremlins!

  • tau start still fails , even after running the command to generate the secret
    (I’m not sure if it’s simply a versioning issue, and how to check app and OTP version, for elixir…

erl returns

Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Eshell V14.1.1 

RUBY_VERSION from irb returns "3.1.3"

ERROR! Config provider Config.Reader failed with:
** (RuntimeError) environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret

    c:/dev/sonic-pi/app/server/beam/tau/_build/prod/rel/tau/releases/0.1.0/runtime.exs:119: (file)
    (elixir 1.15.4) src/elixir.erl:376: anonymous fn/4 in :elixir.eval_external_handler/1
    (stdlib 5.1.1) erl_eval.erl:750: :erl_eval.do_apply/7
    (stdlib 5.1.1) erl_eval.erl:494: :erl_eval.expr/6
    (stdlib 5.1.1) erl_eval.erl:136: :erl_eval.exprs/6
    (elixir 1.15.4) src/elixir.erl:361: :elixir.eval_forms/4
    (elixir 1.15.4) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1
    (elixir 1.15.4) lib/code.ex:543: Code.validated_eval_string/3

Runtime terminating during boot ({#{message=><<101,110,118,105,114,111,110,109,101,110,116,32,118,97,114,105,97,98,108,101,32,83,69,67,82,69,84,95,75,69,89,95,66,65,83,69,32,105,115,32,109,105,115,115,105,110,103,46,13,10,89,111,117,32,99,97,110,32,103,101,110,101,114,97,116,101,32,111,110,101,32,98,121,32,99,97,108,108,105,110,103,58,32,109,105,120,32,112,104,120,46,103,101,110,46,115,101,99,114,101,116,13,10>>,'__struct__'=>'Elixir.RuntimeError','__exception__'=>true},[{elixir_eval,'__FILE__',1,[{file,"c:/dev/sonic-pi/app/server/beam/tau/_build/prod/rel/tau/releases/0.1.0/runtime.exs"},{line,119}]},{elixir,'-eval_external_handler/1-fun-2-',4,[{file,"src/elixir.erl"},{line,376},{error_info,#{module=>'Elixir.Exception'}}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,750}]},{erl_eval,expr,6,[{file,"erl_eval.erl"},{line,494}]},{erl_eval,exprs,6,[{file,"erl_eval.erl"},{line,136}]},{elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,361}]},{'Elixir.Module.ParallelChecker',verify,1,[{file,"lib/module/parall
=ERROR REPORT==== 18-Nov-2023::19:14:05.252000 ===
Error in process <0.9.0> with exit value:
{#{message =>
       <<"environment variable SECRET_KEY_BASE is missing.\r\nYou can generate one by calling: mix phx.gen.secret\r\n">>,
   '__struct__' => 'Elixir.RuntimeError','__exception__' => true},
           {error_info,#{module => 'Elixir.Exception'}}]},

Crash dump is being written to: erl_crash.dump...done

Out of curiosity & for comparison I also tried tau start in the SonicPi _build\...\tau\bin folder in ProgramFiles
C:\Program Files\Sonic Pi\app\server\beam\tau\_build\prod\rel\tau\bin>

Not sure if this fails on Windows, due to path spaces, or if it’s not meant to be used here, or if not working for several other reasons!

Question one, to surmise, is what versions of things are needed?
and maybe question two, is how do I check if my secret is generated?

Can provide or check any crash logs etc if that helps?


Not sure why you are having such difficulty in building on Windows. I very rarely use Windows PC: I only have access to a farily ancient HP Pavilion running Windows 10 Home Edition. However I ran through an install this afternoon following the build instructions and it seemed to go very smoothly. This is what I had installed on the machine:

ruby --version
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt]

elixir --version
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.14.3 (compiled with Erlang/OTP 25)

cmake --version
cmake version 3.26.0-rc5

Qt version Qt6.4.2

Visual Studio 2022 ver 17.5.1

Edition Windows 10 Home
Version 21H2
Installed on ‎24/‎01/‎2021
OS build 19044.3086

I set the QT_INSTALL_LOCATION environmental varialbe using rapidee app listed in the build instructions, In my case to QT_INSTALL_LOCATION=C:\dev\Qt\6.4.2\msvc2019_64
I used the Developer Command Prompt (run in administrator mode)
Created the link to ruby on the app\server\native folder as described
installed gem rugged

Then I simply ran the windows-build-all.bat file and had a cup of tea!
Build had no problems and it executed OK when built.

Are you building inside visual studio?
I actually just used the Visual Studio Developer Command Prompt (opened as administrator) directly.
and just ran the win-build-all.bat script directly from that. Looking at your set up its very similar, except I was using qt6.4.2 and so some of the versions were older. I installed cmake directly not just relying on the one installed by Qt, although that was there too.

elevated cmd - I was unaware the vs-dev-cmd differed! Another mistake of mine.

Are you using the cmake to make qt from the source?
I found your version @ - I thought I had to build qt before I could begin the SP build process, or am I mistaken here also?!

If I do need (or want) to use cmake to build qt does that also need running from (elevated) vs_dev_cmd ?

Really useful Robin, as always :pray:

No I just installed qt from the online installer same I think as you have done. However I have also before now built it from source.

Hello again :slightly_smiling_face: I think the problems I’m having relate to dependencies that the build process is trying to get, namely stuff like tailwind and libwinpthread, and these issues appear to occur in other build issues reported (Issues · sonic-pi-net/sonic-pi · GitHub)

I read elsewhere that building 4.4 wouldn’t require many web-dependency things, so I’m extracting files from that zip to test - v4.4 build completed successfully :exploding_head:
but no Release\sonic-pi.exe in qt
build log, for ref’

I’ll also try to place files that can’ be downloaded into “pickup” directory (eg tailwind in the tau _build dir as suggested by the build messages), and also adding additional path info as recommended elsewhere, like c++ - cc1.exe System Error - libwinpthread-1.dll missing - But it isn't - Stack Overflow

my latest build-fail log

TlDr: progress :+1:t2: