# Can't build juceaide - compilers found, and then not found

**URL:** <https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700>\
**Category:** CMake\
**Created:** [June 28, 2021, 8:51pm UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700 "2021-06-28T20:51:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anoesisaudio](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anoesisaudio/32/1132_2.png) [@anoesisaudio](https://forum.juce.com/u/anoesisaudio)\
**Post date:** [June 28, 2021, 8:51pm UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/1 "2021-06-28T20:51:22Z")

</div>

Hello,

I am trying (well, failing, really) to build VS project files using CMake and Ninja with the following command on Windows 10 (using Clang as the compiler and VS2019).

```auto
cmake -B_builds -GNinja -DCMAKE_CXX_COMPILER:PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin\clang++.exe" -DCMAKE_C_COMPILER:PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin\clang.exe" -DCMAKE_RC_COMPILER:PATH="C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\rc.exe"

```

I am getting this output…

```auto
-- The C compiler identification is Clang 11.0.0 with GNU-like command-line
-- The CXX compiler identification is Clang 11.0.0 with GNU-like command-line
-- 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/Llvm/x64/bin/clang.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/Llvm/x64/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python.exe (found version "3.7.8") found components: Interpreter 
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE  
-- Configuring juceaide
CMake Error at JUCE/extras/Build/juceaide/CMakeLists.txt:76 (message):
  Failed to configure juceaide
  -- The C compiler identification is unknown
  -- The CXX compiler identification is unknown
  CMake Error at CMakeLists.txt:30 (project):
    No CMAKE_C_COMPILER could be found.

```

It seems that CMake is finding the compilers initially, then not finding them when building juceaide.

It is quite possible (ok, probable) that I am doing something wildly incorrect, but I’m a bit of a Windows neophyte and my CMake knowledge is incomplete. Can anyone offer any suggestions on how I can get CMake to succeed with these tools?

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 28, 2021, 9:10pm UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/2 "2021-06-28T21:10:24Z")

</div>

In our CI, our GNU-Clang and Ninja build sets the following environment variables:

```auto
RC = llvm-rc.exe
CC = clang.exe
CXX = clang++.exe

```

It also adds the `Tools/LLvm/bin` directory to the `PATH` environment variable before the build. Finally, it adds the flag `-fuse-ld=lld-link.exe` to the `CMAKE_CXX_FLAGS`, because otherwise the build would use the MSVC linker, which doesn’t seem to be compatible with LLVM LTO.

If you don’t mind giving up Ninja, the Visual Studio exporter is a bit easier to get running with clang. You should be able to just `cmake -G "Visual Studio 16 2019" -T ClangCL -A x64` and get a working clang build.

---

<div class="post-metadata">

**Author:** ![anoesisaudio](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anoesisaudio/32/1132_2.png) [@anoesisaudio](https://forum.juce.com/u/anoesisaudio)\
**Post date:** [June 28, 2021, 9:14pm UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/3 "2021-06-28T21:14:06Z")

</div>

Ah, wonderful. I will give that a shot. Thank you!

---

<div class="post-metadata">

**Author:** ![anoesisaudio](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anoesisaudio/32/1132_2.png) [@anoesisaudio](https://forum.juce.com/u/anoesisaudio)\
**Post date:** [June 29, 2021, 2:23am UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/4 "2021-06-29T02:23:46Z")

</div>

@reuk **Thank you much.** I got it working (not sure how I did not add those env variables…seems kind of obvious now 🙄).

I ended up keeping Ninja which isn’t a requirement now, but will be at some point.

Anyway, I did get some warnings so I thought I should let you know. On first glance, they appear to all be related to conversions between data types. See below.

(Note: plug-Example and plug-Example\_tests are what is built.)

```auto

In file included from ../JUCE/modules/juce_events/juce_events.cpp:83:
../JUCE/modules/juce_events/native/juce_win32_Messaging.cpp:72:61: warning: implicit conversion loses integer precision: 'unsigned long long' to 'DWORD' (aka 'unsigned long') [-Wshorten-64-to-32]
            data.cbData = ((size_t) localCopy.length() + 1) * sizeof (CharPointer_UTF32::CharType);
                        ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[25/83] Building CXX object plug-Example/plug/CMakeFiles/plug-Example_tests.dir/ __/__ /JUCE/modules/juce_events/juce_events.cpp.obj
In file included from ../JUCE/modules/juce_events/juce_events.cpp:83:
../JUCE/modules/juce_events/native/juce_win32_Messaging.cpp:72:61: warning: implicit conversion loses integer precision: 'unsigned long long' to 'DWORD' (aka 'unsigned long') [-Wshorten-64-to-32]
            data.cbData = ((size_t) localCopy.length() + 1) * sizeof (CharPointer_UTF32::CharType);
                        ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[26/83] Building CXX object plug-Example/plug/CMakeFiles/plug-Example.dir/ __/__ /JUCE/modules/juce_core/juce_core.cpp.obj
In file included from ../JUCE/modules/juce_core/juce_core.cpp:219:
../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:46:32: warning: cast from 'std::aligned_storage<44, 4>::type *' (aka '_Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' 
(aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
    InitializeCriticalSection ((CRITICAL_SECTION*) &lock);
                               ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:49:78: warning: cast from 'std::aligned_storage<44, 4>::type *' (aka '_Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' 
(aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
CriticalSection::~CriticalSection() noexcept { DeleteCriticalSection ((CRITICAL_SECTION*) &lock); }
                                                                             ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:50:77: warning: cast from 'const std::aligned_storage<44, 4>::type *' (aka 'const _Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' (aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
void CriticalSection::enter() const noexcept { EnterCriticalSection ((CRITICAL_SECTION*) &lock); }
                                                                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:51:87: warning: cast from 'const std::aligned_storage<44, 4>::type *' (aka 'const _Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' (aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
bool CriticalSection::tryEnter() const noexcept { return TryEnterCriticalSection ((CRITICAL_SECTION*) &lock) != FALSE; }
                                                                                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:52:77: warning: cast from 'const std::aligned_storage<44, 4>::type *' (aka 'const _Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' (aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
void CriticalSection::exit() const noexcept { LeaveCriticalSection ((CRITICAL_SECTION*) &lock); }
                                                                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
[32/83] Building CXX object plug-Example/plug/CMakeFiles/plug-Example_tests.dir/ __/__ /JUCE/modules/juce_core/juce_core.cpp.obj
In file included from ../JUCE/modules/juce_core/juce_core.cpp:219:
../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:46:32: warning: cast from 'std::aligned_storage<44, 4>::type *' (aka '_Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' 
(aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
    InitializeCriticalSection ((CRITICAL_SECTION*) &lock);
                               ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:49:78: warning: cast from 'std::aligned_storage<44, 4>::type *' (aka '_Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' 
(aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
CriticalSection::~CriticalSection() noexcept { DeleteCriticalSection ((CRITICAL_SECTION*) &lock); }
                                                                             ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:50:77: warning: cast from 'const std::aligned_storage<44, 4>::type *' (aka 'const _Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' (aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
void CriticalSection::enter() const noexcept { EnterCriticalSection ((CRITICAL_SECTION*) &lock); }
                                                                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:51:87: warning: cast from 'const std::aligned_storage<44, 4>::type *' (aka 'const _Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' (aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
bool CriticalSection::tryEnter() const noexcept { return TryEnterCriticalSection ((CRITICAL_SECTION*) &lock) != FALSE; }
                                                                                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~../JUCE/modules/juce_core/native/juce_win32_Threads.cpp:52:77: warning: cast from 'const std::aligned_storage<44, 4>::type *' (aka 'const _Align_type<int, 44ULL> *') to 'CRITICAL_SECTION *' (aka '_RTL_CRITICAL_SECTION *') increases required alignment from 4 to 8 [-Wcast-align]
void CriticalSection::exit() const noexcept { LeaveCriticalSection ((CRITICAL_SECTION*) &lock); }
                                                                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
[78/83] Building CXX object plug-Example/plug/CMakeFiles/plug-Example_tests.dir/ __/__ /JUCE/modules/juce_gui_basics/juce_gui_basics.cpp.obj
In file included from ../JUCE/modules/juce_gui_basics/juce_gui_basics.cpp:128:
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:61:52: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
            return getComponentOrderAttributes (a) < getComponentOrderAttributes (b);
                                                   ^
                                                   nullptr
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\tuple:759:97: note: while rewriting comparison as call to 'operator<=>' declared here
_NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Types1, _Types2>...> operator<=>(
                                                                                                ^
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:141:23: note: in instantiation of function template specialization 'juce::FocusHelpers::findAllComponents<bool 
(juce::Component::*)() const noexcept>' requested here
        FocusHelpers::findAllComponents (parentComponent,
                      ^
1 warning generated.

```

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 29, 2021, 7:49am UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/5 "2021-06-29T07:49:44Z")

</div>

Thanks for letting me know. It looks like I might have missed some warnings when building in 64-bit mode rather than 32-bit. I’ll put this on my backlog and update the thread once these are fixed.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 30, 2021, 8:16pm UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/6 "2021-06-30T20:16:40Z")

</div>

Thanks again, those warnings are fixed here:

> <https://github.com/juce-framework/JUCE/commit/407966b2ca1f9ed4aaf5514d10efa7f5dfc9bf14>

---

<div class="post-metadata">

**Author:** ![anoesisaudio](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anoesisaudio/32/1132_2.png) [@anoesisaudio](https://forum.juce.com/u/anoesisaudio)\
**Post date:** [July 3, 2021, 3:53pm UTC](https://forum.juce.com/t/cant-build-juceaide-compilers-found-and-then-not-found/46700/7 "2021-07-03T15:53:14Z")

</div>

Hi again @reuk  
Ran into this one today (Windows again).

```auto
In file included from ../JUCE/modules/juce_gui_basics/juce_gui_basics.cpp:128:
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:61:52: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
            return getComponentOrderAttributes (a) < getComponentOrderAttributes (b);
                                                   ^
                                                   nullptr
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\tuple:759:97: note: while rewriting comparison as call to 'operator<=>' declared here
_NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Types1, _Types2>...> operator<=>(
                                                                                                ^
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:141:23: note: in instantiation of function template specialization 'juce::FocusHelpers::findAllComponents<bool (juce::Component::*)() const noexcept>' requested here
        FocusHelpers::findAllComponents (parentComponent,
                      ^
1 warning generated.

```
