flarn2006 / SparketteVCV

My VCV Rack modules
5 stars 0 forks source link

Build failure on macOS platform #3

Closed cschol closed 6 months ago

cschol commented 6 months ago

Check out the error below. Also, some of the warnings should be looked at as well (undefined behavior).

86_64-apple-darwin20.2-clang++-libc++ -Wno-c++17-extensions -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK-mac-x64/include -I/home/build/rack-plugin-toolchain/Rack-SDK-mac-x64/dep/include -MMD -MP -g -O3 -funsafe-math-optimizations -fno-omit-fr
ame-pointer -Wall -Wextra -Wno-unused-parameter -DARCH_X64 -march=nehalem -DARCH_MAC -mmacosx-version-min=10.9  -c -o build/src/Knobs.cpp.o src/Knobs.cpp
In file included from src/DMAFX.cpp:2:                                                                                                                                                                                                                                              
In file included from src/DMA.hpp:2:                                                                                                                                                                                                                                                
src/Utility.hpp:23:18: warning: passing an object of reference type to 'va_start' has undefined behavior [-Wvarargs]                                                                                                                                                                
                va_start(args, name);                                                                                                     
                               ^                                                                                                                                                                                                                                                    
src/Utility.hpp:18:142: note: parameter of type 'const std::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char>> &') is declared here
        TSwitchQuantity* configSwitchWithLabels(Module* module, int paramId, float minValue, float maxValue, float defaultValue, const std::string& name, ...) {
                                                                                                                                                    ^
In file included from src/DMAFX.cpp:2:
src/DMA.hpp:200:7: warning: 'sparkette::DMAExpanderModule<float, bool>::getDMAChannelCount' hides overloaded virtual functions [-Woverloaded-virtual]
                int getDMAChannelCount() {                                                                                                
                    ^                
src/DMAFX.cpp:10:16: note: in instantiation of template class 'sparkette::DMAExpanderModule<float, bool>' requested here
struct DMAFX : DMAExpanderModule<float, bool> {                                                                                                                                                                                                                                     
               ^                                                                                                                          
src/DMA.hpp:101:7: note: hidden overloaded virtual function 'sparkette::DMAClient<float>::getDMAChannelCount' declared here: different qualifiers ('const' vs unqualified)
                int getDMAChannelCount() const override {                                                                                                                                                                                                                           
                    ^                                                                                                                                                                                                                                                               
src/DMA.hpp:101:7: note: hidden overloaded virtual function 'sparkette::DMAClient<bool>::getDMAChannelCount' declared here: different qualifiers ('const' vs unqualified)
src/DMAFX.cpp:138:17: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]                                                                                                            constexpr void getScrollOffsets(int input, int &dx, int &dy) {                                                                                                                                                                                                              
                       ^                                                                                                                                                                                                                                                                                                                                 const                                                                                                                                                                                                          
In file included from src/ColorMixer.cpp:2:
src/Utility.hpp:23:18: warning: passing an object of reference type to 'va_start' has undefined behavior [-Wvarargs]
                va_start(args, name);       
                               ^
src/Utility.hpp:18:142: note: parameter of type 'const std::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char>> &') is declared here
        TSwitchQuantity* configSwitchWithLabels(Module* module, int paramId, float minValue, float maxValue, float defaultValue, const std::string& name, ...) {
                                                                                                                                                    ^
In file included from src/HSV2RGB.cpp:2:
src/Utility.hpp:23:18: warning: passing an object of reference type to 'va_start' has undefined behavior [-Wvarargs]
                va_start(args, name);
                               ^
src/Utility.hpp:18:142: note: parameter of type 'const std::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char>> &') is declared here
        TSwitchQuantity* configSwitchWithLabels(Module* module, int paramId, float minValue, float maxValue, float defaultValue, const std::string& name, ...) {
                                                                                                                                                    ^
src/DMAFX.cpp:138:17: error: constexpr function's return type 'void' is not a literal type
src/Busybox.cpp:319:34: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
                float r = (float)std::rand() / RAND_MAX;
                                             ~ ^~~~~~~~
/home/build/rack-plugin-toolchain/local/osxcross/bin/../SDK/MacOSX11.1.sdk/usr/include/stdlib.h:105:18: note: expanded from macro 'RAND_MAX'
#define RAND_MAX        0x7fffffff      
                        ^~~~~~~~~~
src/Utility.hpp:23:18: warning: passing an object of reference type to 'va_start' has undefined behavior [-Wvarargs]                                                                                                                                                                
                va_start(args, name);                      
                               ^
src/ColorMixer.cpp:67:3: note: in instantiation of function template specialization 'sparkette::configSwitchWithLabels<rack::engine::SwitchQuantity>' requested here
                configSwitchWithLabels(this, BG_MODE_PARAM, 0.f, 2.f, 1.f, "Background Mode", "Off", "RGB", "HSV", nullptr);
                ^                                        
src/Utility.hpp:18:142: note: parameter of type 'const std::string &' (aka 'const basic_string<char, char_traits<char>, allocator<char>> &') is declared here
        TSwitchQuantity* configSwitchWithLabels(Module* module, int paramId, float minValue, float maxValue, float defaultValue, const std::string& name, ...) {

Static analysis confirms the warning above as well (undefined behavior):

src/Utility.hpp:23:18: error: Using reference 'name' as parameter for va_start() results in undefined behaviour. [va_start_referencePassed]
  va_start(args, name);
                 ^

Please fix those as well.

Thanks!

flarn2006 commented 6 months ago

Should be fixed now. I'll wait until the library update before closing the issue to be sure, since I don't have the toolchain set up on my Mac.

cschol commented 6 months ago

All good. Thank you!