Problem building juceaide on GitHub Actions VS2022

This may not be a juce-specific problem because I don’t get this error building locally but has anyone seen the following error building juce cmake projects with VS2019?

cmake version 3.22.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
\n==========================================
PLATFORM: windows
ROOT: /d/a/tracktion_engine/tracktion_engine
DISABLE_BUILD: 
DISABLE_TOOLS: 1
MSBuild not found at , using default
PROJECT_NAME: TestRunner
BINARY_NAME: TestRunner.exe
APP_NAME: TestRunner.exe
APP_DIR: /d/a/tracktion_engine/tracktion_engine/examples/TestRunner/build/TestRunner_artefacts/Release
APP_FILE: /d/a/tracktion_engine/tracktion_engine/examples/TestRunner/build/TestRunner_artefacts/Release/TestRunner.exe
CMAKE_BUILD_DIR: /d/a/tracktion_engine/tracktion_engine/examples/TestRunner/build
CMAKE_GENERATOR: 
DISABLE_BUILD:
RUN_EXAMPLE: 1
DISABLE_TOOLS: 1
RUN_ARGS:
/d/a/tracktion_engine/tracktion_engine/examples/TestRunner
-- Building for: Visual Studio 17 2022
-- The C compiler identification is MSVC 19.30.30709.0
-- The CXX compiler identification is MSVC 19.30.30709.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.30.30705/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/Enterprise/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring juceaide
-- Building juceaide
CMake Error at D:/a/tracktion_engine/tracktion_engine/modules/juce/extras/Build/juceaide/CMakeLists.txt:92 (message):
  Failed to build juceaide

  Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Framework

  Copyright (C) Microsoft Corporation.  All rights reserved.

  

    Checking File Globs
    Checking Build System
    Building Custom Rule D:/a/tracktion_engine/tracktion_engine/modules/juce/extras/Build/juceaide/CMakeLists.txt
    Main.cpp
    juce_build_tools.cpp
    juce_gui_basics.cpp
    juce_graphics.cpp

  C:\Program Files (x86)\Windows
  Kits\10\Include\10.0.20348.0\um\mapi.h(250,15): error C2279: exception
  specification cannot appear in a typedef declaration (compiling source file
  D:\a\tracktion_engine\tracktion_engine\modules\juce\modules\juce_graphics\juce_graphics.cpp)
  [D:\a\tracktion_engine\tracktion_engine\examples\TestRunner\build\cmake_build_juce\tools\extras\Build\juceaide\juceaide.vcxproj]

That same C2279 error is then repeated about 100 times for each juce file compiled and at multiple points in that mapi.h. The weird thing is that it’s a Windows header file.

Any pointers?

1 Like

You can use -DCMAKE_SYSTEM_VERSION=<Windows-SDK-version> to tell CMake to use a specific SDK version.

I got FRUT building with VS2022 on Azure Pipelines (which uses the same environments as GitHub Actions) by passing -DCMAKE_SYSTEM_VERSION=10.0.19041.0.

That’s annoying. I didn’t want to tie the build system to a specific SDK version.

Do you know if its possible to set this from an environment variable? That way I could set it from my matrix without affecting the other Windows builds.

I thiiiink I had a very similar problem on GitHub Actions after I added Perfetto that boiled down to a toolchain mismatch: my main target was set to C++20 but the dependency target was not.

I believe I solved it by setting the following in CMakeLists.txt before any targets are specified:

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

see: Juceaide fails to build on Windows - plugin demo - master branch

Thanks. Let’s see if this works then: CMake: Attempting to fix compile issues with VS2022 · Tracktion/tracktion_engine@117ae92 · GitHub

I’m not sure if the juceaide cmake will pick this up though…

Nope. Same error.

Even setting the SDK version didn’t work for us.

I have a public repo with a minimal example demoing this with both Sudara’s suggestion and mcmartin

My suggestion doesn’t work because CMAKE_SYSTEM_VERSION is not passed down to the nested call to cmake to build juceaide:

1 Like

I’m looking at this now. I think ideally JUCE should support the new Windows SDK, although that’s a bit tricky. I’m pretty sure that “mapi.h” in that version of the SDK simply doesn’t support compilation under C++14…

1 Like

Thanks!
Let me know if there is anything I can do to help out!

This commit should allow recent Windows SDKs to be used with JUCE:

This commit fixes an issue I encountered when attempting to build with Clang-CL in Clion for x64:

I tried out a build of the DemoRunner on Github Actions with these patches in place and it completed successfully. Please let me know if you encounter any issues with these changes and I’ll take another look.

4 Likes

Can confirm the develop branch builds now on Windows Server 2022 with VS 2022.

Thanks, reuk!