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"

prod
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},
 [{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/parallel_checker.ex"},
                                    {line,112}]},
  {'Elixir.Code',validated_eval_string,3,[{file,"lib/code.ex"},{line,543}]}]}


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?

THANKS!!!

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

Computer:
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.

Thanks so much Robin, I first struggled to obtain the versions of certain components, I think Erlang or Elixir or QT. I did manage to build an .exe , but pretty certain I had tonnes of stuff duplicated, namely several cmake applications, and quickly ran out of disk space mainly due to QT source code (is that also needed?)

One thing that wasn’t clear was which of these applications had to be built (qt / cmake) vs which simply had to be installed.

Also I’d wanted to build (debug) in VS, so maybe opted for some install components that aren’t required, maybe are clashing? My path wasn’t updating with some installed stuff, so I added, maybe this also introduced issues…

It sounds like if I have those applications and versions installed, and accessible from path, I should be good to go, for bat-building. For building a debug version (or a version to step-through debug with VS, if there’s a difference) maybe there’s more to it…
I think I have a different OTP, not sure if your version (25) is required.

Are you able to run tau start on your windows build? I read somewhere (maybe a readme, maybe a code comment) that that could be used to start the tau server, but that didn’t seem to work for me (with my pre-built release 4.5 or my own build).

Thanks again for clarifying the versions and that instructions work :+1:

Update:

  • re-installed Qt 6.4.3 (the closest I can find to the recommended version 6.4.2) :heavy_check_mark:

  • checked environment configured; dev cmd has

    • Erlang/OTP 26 [erts-14.1.1]
    • ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt]
  • gem list has rugged

  • ruby symbolic link to ruby_dir created in app\server\native

  • cmake version 3.27.8 maintained and supported by Kitware (kitware.com/cmake).

  • reviewed win-build-all and ran…

The first error I get appears to be about CMakeLists config

"Generating project files..."
-- CMakeLists: Sonic Pi
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:39 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:39 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!
MSBuild version 17.8.3+195e7f5a3 for .NET Framework
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj

build process completes with errors, .exe not built.
Think I’ve squashed this error before, but can’t remember how, other than checking cmake accessible from prompt
(I’m quite new these tools and languages and things, like rubies and gems and candles and cmakers … and wix !) -

No CMAKE_CXX_COMPILER could be found.

:bulb: I want to say I think I’ve fixed, but don’t wanna jinx
After looking into cmake --help and the info in CMakeLists.txt:
# Sonic Pi Requires a C++ 17 Compiler to build it
… I found this, that suggests I’ve picked the wrong windows SDK

Install C11 and C17 support in Visual Studio | Microsoft Learn

  • replaced 10.0.19041 with win10SDK_10.0.20348
  • ran win_clean
  • relaunched admin prompt, and restarted the build…
  • I think it’s kettle time :crossed_fingers:

Spoke too soon :cry:

C:\dev\sonic-pi\app\build>cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release ..\
-- CMakeLists: Sonic Pi
-- Selecting Windows SDK version 10.0.20348.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.38.33130.0
-- The CXX compiler identification is MSVC 19.38.33130.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TARGET_WIN
-- System: Windows-10.0.19045
-- Compiler: MSVC
-- Compiler Version: 19.38.33130.0
-- Debug Flags:  -D_DEBUG -DDEBUG
-- Release Flags:
-- Externals Builder
-- USE_SYSTEM_LIBS: OFF
-- CMAKE_BUILD_TYPE: Release
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found

-- CMakeLists: Sonic Pi Qt GUI
-- Setting prefix to user-defined Qt install location: C:\Qt\6.4.3\msvc2019_64
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Failed
-- Performing Test HAVE_STDATOMIC_WITH_LIB
-- Performing Test HAVE_STDATOMIC_WITH_LIB - Failed
-- Found WrapAtomic: TRUE
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)

Not sure if I need to reinstall another QT, again, or cmake…the towel is getting close!

doubt it’ll help, but the QT components I have installed include

6.4.3 main options
image

tonnes of libraries
image

dev tools
image

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 @ https://download.qt.io/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.zip - 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.