Guidance on building examples on Windows (Solved)

Hey All,

I had a hell of a time trying to build the Tracktion Engine examples on Windows. A lot of the issues are highlighted in this post: Tracktion Engine - compilation errors and demo example problems on Windows

Some of the issues stemmed from the fact that, like the above poster, I was also trying to build for Visual Studio 2019 and not 2017 (which was hard-coded into the build .bat files and project PIP files).

I noticed that as of this commit on the develop branch - 66446804289950bc49830578c50f89d04dddf24f, the platform-specific build scripts have been removed in favor of a single CMake solution. It seems like this is an improved approach, as it looks like generating and building example projects for the target platform and build environment will be much more dynamic, especially on Windows where everything was previously hard-coded into .bat files (including Visual Studio version and MSBuild paths, etc.). However, I am admittedly completely new/unfamiliar with CMake. I’ve installed it on Windows, but the two build script files (‘generate_examples’ and ‘build’) are bash script files.

Examining the build scripts seems to indicate it should be possible to call them from Windows, but it’s not obvious how one would execute a bash script under something like Windows Terminal or PowerShell. This article gives some hints, but not anything that really helps in this scenario it would seem.

I do have the Windows Subsystem for Linux installed, and I can run a bash shell, however when I drop into a bash shell and attempt to run the generate_examples or build scripts directly I get the following error/output:

: invalid option

It seems like executing this build script from WSL is not the intention, because the $OSTYPE is linux-gnu and not the build script’s intended value of ‘msys’. Do I need to run this under something else like MinGW instead? I’m super confused because it looks like the intention is for the build script to support Windows, but there is really no guidance in the on how to run the build script on Windows with CMake, and further more, the hard-coded .bat files, which didn’t work out-of-the-box before, but could be hacked to work, are now removed from the repo.

I feel like getting up and running with the examples on Windows is, and has been, quite dysfunctional and under-supported that it is going to turn a lot of interested Windows developers away from using Tracktion Engine, which is unfortunate.

I personally wouldn’t mind trying to clean this up and offer a pull request, but I need a little guidance first. Are the bash scripts generate_examples and build supposed to run on Windows, and if so, what is the intended solution to accomplish this?

Also, can we please add some support for more than just Visual Studio 2017 seeing as how we are now on Visual Studio 2022? The new build script still only works with Visual Studio 2017.

Thanks for any help with this, I’m hoping there is just a key piece of info that is missing from the README that is causing my hang up!

Update: I tried running the build script with the MinGW64 Git Bash that installs with Git for Windows and that worked! Adding this detail to the Tracktion Engine would be a great addition to avoid confusion when building examples on Windows.

I still had to manually edit the build script to target Visual Studio 2019, perhaps the script could be updated to either use an interactive prompt to let the user select with version they want to target, or it could just use a series of if/fi that attempt to auto-detect the available version starting with the latest versions and falling back to older versions if the path to MSBuild doesn’t exist.

1 Like

Sorry, I use bash because it means I can use the same script on all platforms which is much easier to reason about and maintain. As Git on Windows comes with bash, I assume everyone who gets the source will be able to run it. I can add a note to this effect though.

Regarding the MSVC version, That’s all done here: Windows: Make CMake use the default version of VS installed and use… · Tracktion/tracktion_engine@2432047 · GitHub

Should work on any Windows platform with CMake and a version of VS installed now. Let me know if you have problems.

1 Like

Looks good to me! Much appreciated. I edited the build script to let you specify which version you want to use if you have multiple versions of MSBuild installed using an env var MSBUILD_VERSION, and I was going to contribute it here, but it looks like that commit you linked to works, and is a simpler solution. Cheers.

Also, for what it’s worth, the Benchmark project when it runs, eventually totally hoses my system. It seems like some real-time thread just completely runs away with CPU and eventually my system becomes completely unresponsive, and I’m forced to reboot via holding down the power button. I’ve never successfully made it through the Benchmark process on Windows, I’ve always had to disable the Benchmark from running in the build script in order to get past it.

Do you know what it’s running when it becomes unresponsive?

Sorry, I haven’t had a chance to test the Benchmark app again to see exactly where it hangs, but I hope to test this soon and get back to you with the results.

OK, so I was able to run the Benchmark app again. I was watching in Windows Resource Monitor to see if I could notice any spike in CPU when it hangs.

I noticed some other weird behavior, which may or may not be expected: in between running batches of benchmarks I would see a quick spike in CPU, but typically very short, I’d see some output to the console, and then usually it would stop on All tests completed successfully for the current set of benchmarks, and it would sit there, with no CPU usage, and no console output for sometimes up to a couple minutes before the next set of benchmark tests would run. Does this seem right? What is it doing between batches of benchmark tests where CPU sits at 0% while it waits over a minute before continuing? Even with this weird behavior my computer still remain responsive.

And then of course I got the hang where everything becomes unresponsive. Based on the behavior I witnessed with these weird stalls on prior benchmark tests (sitting on All tests completed successfully), it looks like the test it hung on never printed its name, so we only have the last successfully completed test to go on, which was:

Starting test: Rack Benchmarks / RackMixBus - rendering : 96000, 128, MT, lock-free, realTime, 2 channels, 20s...

It got through that test, printed All tests completed successfully, and then hung and became unresponsive. I’m attaching a screen shot I grabbed with my phone since by the time it happens there’s not much I can do on the computer itself.

  • Windows 10 on Intel x64
  • Tracktion Engine develop branch 3a0bb5488cb946a5ef6295a386ae7fedea32c49f
  • JUCE submodule fdd9eb8eeb016e25f8f6be093c561c4523f001c6

Also, when beginning to build the Benchmark app:

PLATFORM: windows
PROJECT_NAME: Benchmarks
BINARY_NAME: Benchmarks.exe
APP_NAME: Benchmarks.exe
APP_DIR: /c/dev/tracktion_engine/examples/Benchmarks/build/Benchmarks_artefacts/Release
APP_FILE: /c/dev/tracktion_engine/examples/Benchmarks/build/Benchmarks_artefacts/Release/Benchmarks.exe
CMAKE_BUILD_DIR: /c/dev/tracktion_engine/examples/Benchmarks/build
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.29.30138.0
-- The CXX compiler identification is MSVC 19.29.30138.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/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 (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Not building with VST2
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Dev/tracktion_engine/examples/Benchmarks/build
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Hope this helps. I’m seeing some other weird behavior in terms of differences between building from PIP vs. using the build script, but I will report on that in another thread for visibility.