cmajor-lang/cmajor

Lots of compile errors when building the cmajor tools on Windows

Closed this issue · 2 comments

Just trying to build the tools with the usual commands from the repo root:

cmake -S . -B build 
cmake --build build --config RelWithDebInfo

I get flooded with lots of different compile errors lile:

MSBuild version 17.7.2+d6990bcfa for .NET Framework

  Checking File Globs
  1>Checking Build System
  Generating CmajPlugin_artefacts/JuceLibraryCode/CmajPlugin_resources.rc
  Building Custom Rule D:/me/MUSICA/dev/cmajor/cmajor/tools/CmajPlugin/CMakeLists.txt
  CmajPlugin_rc_lib.vcxproj -> D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\CmajPlugin_rc_lib.dir\Debug\CmajPl
  ugin_rc_lib.lib
  Building Custom Rule D:/me/MUSICA/dev/cmajor/cmajor/tools/CmajPlugin/CMakeLists.txt
  cmaj_Program.cpp
  cmaj_CPlusPlusGenerator.cpp
  cmaj_CPlusPlusPerformer.cpp
  cmaj_LLVMPerformer.cpp
  cmaj_wasm_libs_binaryen1.cpp
  cmaj_wasm_libs_binaryen2.cpp
  cmaj_wasm_libs_binaryen3.cpp
  cmaj_wasm_libs_binaryen4.cpp
  cmaj_wasm_libs_binaryen5.cpp
  cmaj_WebAssemblyGenerator.cpp
  cmaj_WebAssemblyPerformer.cpp
  cmaj_EngineTypeList.cpp
  cmaj_ErrorHandling.cpp
  cmaj_Transformations.cpp
  cmaj_AllocationChecker.cpp
D:\me\MUSICA\dev\include\cmajor\COM\cmaj_ProgramInterface.h(36,1): error C2011: 'cmaj::SyntaxTreeOptions': 'struct' typ
e redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerfor
mer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_ProgramInterface.h(35,8): message : see declaration of 'cmaj::Sy
ntaxTreeOptions' (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerf
ormer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\include\cmajor\COM\cmaj_ProgramInterface.h(56,26): error C2011: 'cmaj::ProgramInterface': 'struct' typ
e redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerfor
mer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_ProgramInterface.h(56,8): message : see declaration of 'cmaj::Pr
ogramInterface' (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerfo
rmer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\include\cmajor\COM\cmaj_PerformerInterface.h(50,29): error C2011: 'cmaj::PerformerInterface': 'struct'
 type redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPe
rformer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_PerformerInterface.h(50,8): message : see declaration of 'cmaj::
PerformerInterface' (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMP
erformer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\include\cmajor\COM\cmaj_CacheDatabaseInterface.h(40,33): error C2011: 'cmaj::CacheDatabaseInterface':
'struct' type redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cma
j_LLVMPerformer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_CacheDatabaseInterface.h(40,8): message : see declaration of 'cm
aj::CacheDatabaseInterface' (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cm
aj_LLVMPerformer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\include\cmajor\COM\cmaj_EngineInterface.h(47,26): error C2011: 'cmaj::EngineInterface': 'struct' type
redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerforme
r.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_EngineInterface.h(47,8): message : see declaration of 'cmaj::Eng
ineInterface' (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerform
er.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\../../../include/cmajor/COM/cmaj_EngineFactoryInterface.h(44,33): error C2011: '
cmaj::EngineFactoryInterface': 'struct' type redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules
\compiler\src\backends\LLVM\cmaj_LLVMPerformer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.v
cxproj]
(...)

and many more of different types down the road.

This is the output from the cmake generator:

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.37.32822.0
-- The CXX compiler identification is MSVC 19.37.32822.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.37.32822/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.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Defaulting CMAJ_VERSION to 1.0
Including the command line tool
Configuring Cmajor lib:           command_cmaj_lib
CMAJ_INCLUDE_SERVER:              TRUE
CMAJ_INCLUDE_SCRIPTING:           TRUE
CMAJ_INCLUDE_PLAYBACK:            TRUE
CMAJ_ENABLE_PERFORMER_LLVM:       TRUE
CMAJ_ENABLE_PERFORMER_WEBVIEW:    TRUE
CMAJ_ENABLE_PERFORMER_CPP:        TRUE
CMAJ_ENABLE_CODEGEN_CPP:          TRUE
CMAJ_ENABLE_CODEGEN_LLVM_WASM:    TRUE
CMAJ_ENABLE_CODEGEN_BINARYEN:     TRUE
Including wasm
Including x64
Including the Cmajor shared library
Configuring Cmajor lib:           performer_cmaj_lib
CMAJ_INCLUDE_SERVER:              FALSE
CMAJ_INCLUDE_SCRIPTING:           FALSE
CMAJ_INCLUDE_PLAYBACK:            TRUE
CMAJ_ENABLE_PERFORMER_LLVM:       TRUE
CMAJ_ENABLE_PERFORMER_WEBVIEW:    FALSE
CMAJ_ENABLE_PERFORMER_CPP:        FALSE
CMAJ_ENABLE_CODEGEN_CPP:          FALSE
CMAJ_ENABLE_CODEGEN_LLVM_WASM:    FALSE
CMAJ_ENABLE_CODEGEN_BINARYEN:     FALSE
Including wasm
Including x64
Including plugin build
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- 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
-- Found Threads: TRUE
Configuring Cmajor lib:           cmajor_lib
CMAJ_INCLUDE_SERVER:              FALSE
CMAJ_INCLUDE_SCRIPTING:           FALSE
CMAJ_INCLUDE_PLAYBACK:            TRUE
CMAJ_ENABLE_PERFORMER_LLVM:       TRUE
CMAJ_ENABLE_PERFORMER_WEBVIEW:    FALSE
CMAJ_ENABLE_PERFORMER_CPP:        FALSE
CMAJ_ENABLE_CODEGEN_CPP:          FALSE
CMAJ_ENABLE_CODEGEN_LLVM_WASM:    FALSE
CMAJ_ENABLE_CODEGEN_BINARYEN:     FALSE
Including wasm
Including x64
Including example projects
Configuring Cmajor lib:           examples_cmaj_lib
CMAJ_INCLUDE_SERVER:              FALSE
CMAJ_INCLUDE_SCRIPTING:           FALSE
CMAJ_INCLUDE_PLAYBACK:            TRUE
CMAJ_ENABLE_PERFORMER_LLVM:       TRUE
CMAJ_ENABLE_PERFORMER_WEBVIEW:    FALSE
CMAJ_ENABLE_PERFORMER_CPP:        FALSE
CMAJ_ENABLE_CODEGEN_CPP:          FALSE
CMAJ_ENABLE_CODEGEN_LLVM_WASM:    FALSE
CMAJ_ENABLE_CODEGEN_BINARYEN:     FALSE
Including wasm
Including x64
-- Configuring done (28.6s)
-- Generating done (0.4s)

If you look at the errors, it's telling you that you have more than one copy of some files:

D:\me\MUSICA\dev\include\cmajor\COM\cmaj_ProgramInterface.h(36,1): error C2011: 'cmaj::SyntaxTreeOptions': 'struct' typ
e redefinition (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerfor
mer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]
D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_ProgramInterface.h(35,8): message : see declaration of 'cmaj::Sy
ntaxTreeOptions' (compiling source file D:\me\MUSICA\dev\cmajor\cmajor\modules\compiler\src\backends\LLVM\cmaj_LLVMPerf
ormer.cpp) [D:\me\MUSICA\dev\cmajor\cmajor\build\tools\CmajPlugin\cmajor_lib.vcxproj]

i.e. you have

D:\me\MUSICA\dev\cmajor\cmajor\include\cmajor\COM\cmaj_ProgramInterface.h
D:\me\MUSICA\dev\include\cmajor\COM\cmaj_ProgramInterface.h

No idea how you've ended up with two copies of the repo in your include path, but I don't think this is a bug on our part.

@julianstorer thanks so much for your eyes! I knew it was because the files were included tweice (the only reason!) but I couldn't see the two different paths.
I really don't know how that additional include folder was created and why the build was picking it.

Sorry for the noise!