JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

[Bug]: Error in CMake configuration phase at commit id e3489703f

Open lucaayscough opened this issue 1 year ago • 6 comments

Detailed steps on how to reproduce the bug

Attempting to configure the JUCE project yields an error. I've traced to this commit ID: e3489703f.

cmake -B . -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"

-- Building formats: VST3;AU;Standalone
-- The CXX compiler identification is AppleClang 16.0.0.16000026
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Testing juceaide
-- Finished setting up juceaide
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (31.1s)
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_C_COMPILE_OBJECT
-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

Running `cmake --build .

[  1%] Generating juce_binarydata_Assets/JuceLibraryCode/BinaryData1.cpp, juce_binarydata_Assets/JuceLibraryCode/BinaryData2.cpp, juce_binarydata_Assets/JuceLibraryCode/BinaryData.h
[  3%] Building CXX object CMakeFiles/Assets.dir/juce_binarydata_Assets/JuceLibraryCode/BinaryData1.cpp.o
[  4%] Building CXX object CMakeFiles/Assets.dir/juce_binarydata_Assets/JuceLibraryCode/BinaryData2.cpp.o
[  6%] Linking CXX static library libAssets.a
[  6%] Built target Assets
[  7%] Generating Automate_artefacts/JuceLibraryCode/JuceHeader.h
[  9%] Building CXX object CMakeFiles/Automate.dir/src/juce_build.cpp.o
[ 10%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_processors/juce_audio_processors_ara.cpp.o
[ 12%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_processors/juce_audio_processors_lv2_libs.cpp.o
[ 14%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_processors/juce_audio_processors.mm.o
[ 15%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_gui_extra/juce_gui_extra.mm.o
[ 17%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_gui_basics/juce_gui_basics.mm.o
[ 18%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_graphics/juce_graphics_Harfbuzz.cpp.o
[ 20%] Building C object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_graphics/juce_graphics_Sheenbidi.c.o
[ 21%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_graphics/juce_graphics.mm.o
[ 23%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_events/juce_events.mm.o
[ 25%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_core/juce_core_CompilationTime.cpp.o
[ 26%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_core/juce_core.mm.o
[ 28%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_data_structures/juce_data_structures.mm.o
[ 29%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_basics/juce_audio_basics.mm.o
[ 31%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_utils/juce_audio_utils.mm.o
[ 32%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_formats/juce_audio_formats.mm.o
[ 34%] Building CXX object CMakeFiles/Automate.dir/extern/JUCE/modules/juce_audio_devices/juce_audio_devices.mm.o
[ 35%] Linking CXX static library Automate_artefacts/Release/libAutomate_SharedCode.a
ar: CMakeFiles/Automate.dir/extern/JUCE/modules/juce_graphics/juce_graphics_Sheenbidi.c.o: No such file or directory
make[2]: *** [Automate_artefacts/Release/libAutomate_SharedCode.a] Error 1
make[2]: *** Deleting file `Automate_artefacts/Release/libAutomate_SharedCode.a'
make[1]: *** [CMakeFiles/Automate.dir/all] Error 2
make: *** [all] Error 2

Running on a 16" MacBook Pro 2021 M1 Pro with macOS 16

cmake version 3.30.4

Homebrew clang version 19.1.0 Target: arm64-apple-darwin24.0.0 Thread model: posix InstalledDir: /opt/homebrew/Cellar/llvm/19.1.0/bin

What is the expected behaviour?

.

Operating systems

macOS

What versions of the operating systems?

macOS 16

Architectures

ARM

Stacktrace

No response

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

  • [X] I agree to follow the Code of Conduct

lucaayscough avatar Sep 30 '24 15:09 lucaayscough

Have you tried completely removing your build directory and configuring from scratch?

reuk avatar Sep 30 '24 17:09 reuk

Yeah

lucaayscough avatar Oct 01 '24 10:10 lucaayscough

This is the CMakeLists for reference:

################################################################################

set(PLUGIN_NAME              Automate)
set(PLUGIN_VERSION           0.1.1)
set(PLUGIN_MANUFACTURER_CODE Chrm)
set(PLUGIN_CODE              Auto)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")

################################################################################

cmake_minimum_required(VERSION 3.22)

set(FORMATS "VST3;AU;Standalone" CACHE STRING "Plugin formats for JUCE to build. Valid formats: VST AU AUv3 Standalone")
message("-- Building formats: ${FORMATS}")

project(${PLUGIN_NAME} VERSION ${PLUGIN_VERSION} LANGUAGES CXX)

add_subdirectory(extern/JUCE)

juce_add_plugin(${PLUGIN_NAME}
  COMPANY_NAME "Chroma Audio"
  BUNDLE_ID com.chromaaudio.automate
  PLUGIN_MANUFACTURER_CODE ${PLUGIN_MANUFACTURER_CODE}
  PLUGIN_CODE ${PLUGIN_CODE}
  FORMATS ${FORMATS}
  PRODUCT_NAME ${PLUGIN_NAME}
  EDITOR_WANTS_KEYBOARD_FOCUS FALSE
  COPY_PLUGIN_AFTER_BUILD TRUE 
  VST3_CATEGORIES Fx
  AU_MAIN_TYPE kAudioUnitType_Effect
  MICROPHONE_PERMISSION_ENABLED FALSE 
  NEEDS_MIDI_INPUT TRUE
  NEEDS_MIDI_OUTPUT TRUE 
  IS_MIDI_EFFECT FALSE
)

juce_generate_juce_header(${PLUGIN_NAME})

juce_add_binary_data(Assets SOURCES
  assets/sofia_pro_regular.otf
  assets/sofia_pro_medium.otf
)

target_sources(${PLUGIN_NAME} PRIVATE src/juce_build.cpp)

target_compile_definitions(${PLUGIN_NAME} PUBLIC
  JUCE_WEB_BROWSER=0
  JUCE_USE_CURL=0
  JUCE_VST3_CAN_REPLACE_VST2=0
  JUCE_PLUGINHOST_VST3=1
  JUCE_PLUGINHOST_AU=1)

target_link_libraries(${PLUGIN_NAME} PRIVATE
  Assets
  juce::juce_audio_utils
  juce::juce_audio_devices
  juce::juce_recommended_config_flags # Sets stuff like optimisation level
  juce::juce_recommended_lto_flags
  juce::juce_recommended_warning_flags)

lucaayscough avatar Oct 01 '24 10:10 lucaayscough

Can you try removing LANGUAGES CXX, and/or trying with LANGUAGES C CXX?

project(${PLUGIN_NAME} VERSION ${PLUGIN_VERSION} LANGUAGES CXX)

The SheenBidi translation unit must be built as C, not C++.

reuk avatar Oct 01 '24 10:10 reuk

That seems to have fixed the build config but now the compilation fails:

In file included from /Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.mm:35:                                                                                                                      
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2898:36: error: no member named 'tryVst2StateLoad' in namespace 'VST3'                                                                        
 2898 |         if (auto vst2State = VST3::tryVst2StateLoad (*state))                                                                                                                                                                                         
      |                              ~~~~~~^                                                                                                                                                                                                                  
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2937:26: error: use of undeclared identifier 'vst2State'; did you mean 'outState'?                                                            
 2937 |         VST3::Vst2xState vst2State;                                                                                                                                                                                                                   
      |                          ^~~~~~~~~                                                                                                                                                                                                                    
      |                          outState                                                                                                                                                                                                                     
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2935:84: note: 'outState' declared here                                                                                                       
 2935 |     tresult getStateWithVst2Compatibility (const MemoryBlock& dataChunk, IBStream& outState)                                                                                                                                                          
      |                                                                                    ^                                                                                                                                                                  
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2937:25: error: expected ';' after expression                                                                                                 
 2937 |         VST3::Vst2xState vst2State;                                                                                                                                                                                                                   
      |                         ^                                                                                                                                                                                                                             
      |                         ;                                                                                                                                                                                                                             
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2937:15: error: no member named 'Vst2xState' in namespace 'VST3'                                                                              
 2937 |         VST3::Vst2xState vst2State;                                                                                                                                                                                                                   
      |         ~~~~~~^                                                                                                                                                                                                                                       
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2939:9: error: use of undeclared identifier 'vst2State'; did you mean 'outState'?                                                             
 2939 |         vst2State.chunk.resize (dataChunk.getSize());                                                                                                                                                                                                 
      |         ^~~~~~~~~                                                                                                                                                                                                                                     
      |         outState                                                                                                                                                                                                                                      
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2935:84: note: 'outState' declared here                                                                                                       
 2935 |     tresult getStateWithVst2Compatibility (const MemoryBlock& dataChunk, IBStream& outState)                                                                                                                                                          
      |                                                                                    ^                                                                                                                                                                  
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2939:19: error: no member named 'chunk' in 'Steinberg::IBStream'                                                                              
 2939 |         vst2State.chunk.resize (dataChunk.getSize());                                                                                                                                                                                                 
      |         ~~~~~~~~~ ^                                                                                                                                                                                                                                   
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2940:56: error: use of undeclared identifier 'vst2State'                                                                                      
 2940 |         std::copy (dataChunk.begin(), dataChunk.end(), vst2State.chunk.begin());                                                                                                                                                                      
      |                                                        ^                                                                                                                                                                                              
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2942:9: error: use of undeclared identifier 'vst2State'; did you mean 'outState'?                                                             
 2942 |         vst2State.fxUniqueID = JucePlugin_VSTUniqueID;                                                                                                                                                                                                
      |         ^~~~~~~~~                                                                                                                                                                                                                                     
      |         outState                                                                                                                                                                                                                                      
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2935:84: note: 'outState' declared here                                                                                                       
 2935 |     tresult getStateWithVst2Compatibility (const MemoryBlock& dataChunk, IBStream& outState)                                                                                                                                                          
      |                                                                                    ^                                                                                                                                                                  
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2942:19: error: no member named 'fxUniqueID' in 'Steinberg::IBStream'                                                                         
 2942 |         vst2State.fxUniqueID = JucePlugin_VSTUniqueID;                                                                                                                                                                                                
      |         ~~~~~~~~~ ^                                                                                                                                                                                                                                   
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2943:9: error: use of undeclared identifier 'vst2State'; did you mean 'outState'?                                                             
 2943 |         vst2State.fxVersion = JucePlugin_VersionCode;                                                                                                                                                                                                 
      |         ^~~~~~~~~                                                                                                                                                                                                                                     
      |         outState                                                                                                                                                                                                                                      
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2935:84: note: 'outState' declared here                                                                                                       
 2935 |     tresult getStateWithVst2Compatibility (const MemoryBlock& dataChunk, IBStream& outState)                                                                                                                                                          
      |                                                                                    ^                                                                                                                                                                  
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2943:19: error: no member named 'fxVersion' in 'Steinberg::IBStream'                                                                          
 2943 |         vst2State.fxVersion = JucePlugin_VersionCode;                                                                                                                                                                                                 
      |         ~~~~~~~~~ ^                                                                                                                                                                                                                                   
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2944:9: error: use of undeclared identifier 'vst2State'; did you mean 'outState'?                                                             
 2944 |         vst2State.isBypassed = isBypassed();                                                                                                                                                                                                          
      |         ^~~~~~~~~                                                                                                                                                                                                                                     
      |         outState                                                                                                                                                                                                                                      
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2935:84: note: 'outState' declared here                                                                                                       
 2935 |     tresult getStateWithVst2Compatibility (const MemoryBlock& dataChunk, IBStream& outState)                                                                                                                                                          
      |                                                                                    ^                                                                                                                                                                  
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2944:19: error: no member named 'isBypassed' in 'Steinberg::IBStream'                                                                         
 2944 |         vst2State.isBypassed = isBypassed();                                                                                                                                                                                                          
      |         ~~~~~~~~~ ^                                                                                                                                                                                                                                   
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2946:19: error: no member named 'writeVst2State' in namespace 'VST3'                                                                          
 2946 |         if (VST3::writeVst2State (vst2State, outState))                                                                                                                                                                                               
      |             ~~~~~~^                                                                                                                                                                                                                                   
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2946:35: error: use of undeclared identifier 'vst2State'                                                                                      
 2946 |         if (VST3::writeVst2State (vst2State, outState))                                                                                                                                                                                               
      |                                   ^                                                                                                                                                                                                                   
/Users/lucaayscough/dev/automate/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2937:26: warning: expression result unused [-Wunused-value]                                                                                   
 2937 |         VST3::Vst2xState vst2State;                                                                                                                                                                                                                   
      |                          ^~~~~~~~~                                                                                                                                                                                                                    
1 warning and 15 errors generated.                                                                                                                                                                                                                            
make[2]: *** [CMakeFiles/Automate_VST3.dir/extern/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.mm.o] Error 1                                                                                                                           
make[1]: *** [CMakeFiles/Automate_VST3.dir/all] Error 2                                                                                                                                                                                                       
make: *** [all] Error 2                                                                                                                                                                                                                                       

lucaayscough avatar Oct 01 '24 11:10 lucaayscough

Can you try removing LANGUAGES CXX, and/or trying with LANGUAGES C CXX?

project(${PLUGIN_NAME} VERSION ${PLUGIN_VERSION} LANGUAGES CXX)

The SheenBidi translation unit must be built as C, not C++.

I had the same issue as OP, and this fixed it for me. Unlike OP it compiles correctly now, even after a fully clean rebuild.

Given how deeply unhelpful the CMake error is in this case, it might make sense to add a message(FATAL_ERROR) somewhere in the JUCE cmake files to warn users that they have to include C in languages.

emezeske avatar Oct 08 '24 22:10 emezeske

We've now added a check to the CMake build that will warn if the C language is not enabled:

https://github.com/juce-framework/JUCE/commit/ec4dfe155657a2cb2c613f7e3629078fac42760a

reuk avatar Nov 05 '24 20:11 reuk