dhemery / DHE-Modules

VCV rack modules from Dale Emery
MIT License
33 stars 2 forks source link

Compilation Issues #8

Closed briansorahan closed 6 years ago

briansorahan commented 6 years ago

Compiling against Rack v0.5 HEAD. First issue is that I checkout the code in plugins/DHE-Modules. The default RACK_DIR seems to expect a different directory structure than what is recommended here.

After setting RACK_DIR, next issue:

make                                                                                                                                                                               
g++ -I./src -fPIC -I../../include -I../../dep/include -DSLUG=DHE-Modules -DVERSION=0.6.0 -MMD -g -O3 -march=nocona -ffast-math -fno-finite-math-only -Wall -Wextra -Wno-unused-parameter -DARCH_LIN  -Wsuggest-ov
erride -std=c++11 -c -o build/src/plugin/dhe-modules.cpp.o src/plugin/dhe-modules.cpp                                                                                                                            
In file included from ./src/modules/booster-stage-widget.h:3:0,                                                                                                                                                  
                 from src/plugin/dhe-modules.cpp:4:                                                                                                                                                              
./src/modules/widget.h:4:10: fatal error: util/math.hpp: No such file or directory                                                                                                                               
 #include <util/math.hpp>                                                                                                                                                                                        
          ^~~~~~~~~~~~~~~                                                                                                                                                                                        
compilation terminated.                                                                                                                                                                                          
make: *** [../../compile.mk:54: build/src/plugin/dhe-modules.cpp.o] Error 1

Since math.hpp is in Rack/include I just change the #include in widget.h to math.hpp. Then I get lots of compilation errors:

g++ -I./src -fPIC -I../../include -I../../dep/include -DSLUG=DHE-Modules -DVERSION=0.6.0 -MMD -g -O3 -march=nocona -ffast-math -fno-finite-math-only -Wall -Wextra -Wno-unused-parameter -DARCH_LIN  -Wsuggest-ov
erride -std=c++11 -c -o build/src/plugin/dhe-modules.cpp.o src/plugin/dhe-modules.cpp                                                                                                                            
In file included from ./src/modules/booster-stage-widget.h:3:0,                                                                                                                                                  
                 from src/plugin/dhe-modules.cpp:4:                                                                                                                                                              
./src/modules/widget.h: In member function ‘float DHE::Widget::height() const’:                                                                                                                                  
./src/modules/widget.h:13:23: error: ‘MM_PER_IN’ was not declared in this scope                                                                                                                                  
     return box.size.y*MM_PER_IN/SVG_DPI;                                                                                                                                                                        
                       ^~~~~~~~~                                                                                                                                                                                 
./src/modules/widget.h: In member function ‘float DHE::Widget::width() const’:                                                                                                                                   
./src/modules/widget.h:17:23: error: ‘MM_PER_IN’ was not declared in this scope                                                                                                                                  
     return box.size.x*MM_PER_IN/SVG_DPI;                                                                                                                                                                        
                       ^~~~~~~~~                                                                                                                                                                                 
./src/modules/widget.h: In member function ‘void DHE::Widget::install_input(int, rack::Vec)’:                                                                                                                    
./src/modules/widget.h:27:28: error: ‘create’ is not a member of ‘rack::Port’                                                                                                                                    
     auto input{rack::Port::create<T>({0, 0}, rack::Port::INPUT, module, index)};                                                                                                                                
                            ^~~~~~                                                                                                                                                                               
./src/modules/widget.h:27:36: error: expected primary-expression before ‘>’ token                                                                                                                                
     auto input{rack::Port::create<T>({0, 0}, rack::Port::INPUT, module, index)};                                                                                                                                
                                    ^                                                                                                                                                                            
./src/modules/widget.h:27:43: error: expected ‘;’ before ‘}’ token                                                                                                                                               
     auto input{rack::Port::create<T>({0, 0}, rack::Port::INPUT, module, index)};                                                                                                                                
                                           ^                                                                                                                                                                     
./src/modules/widget.h:27:44: error: expected ‘)’ before ‘,’ token                                                                                                                                               
     auto input{rack::Port::create<T>({0, 0}, rack::Port::INPUT, module, index)};                                                                                                                                
                                            ^                                                                                                                                                                    
./src/modules/widget.h: In member function ‘void DHE::Widget::install_light(int, rack::Vec)’:                                                                                                                    
./src/modules/widget.h:39:41: error: ‘create’ is not a member of ‘rack::ModuleLightWidget’                                                                                                                       
     auto light{rack::ModuleLightWidget::create<T>({0, 0}, module, index)};                                                                                                                                      
                                         ^~~~~~                                                                                                                                                                  
./src/modules/widget.h:39:49: error: expected primary-expression before ‘>’ token                                                                                                                                
     auto light{rack::ModuleLightWidget::create<T>({0, 0}, module, index)};                                                                                                                                      
                                                 ^                                                                                                                                                               
./src/modules/widget.h:39:56: error: expected ‘;’ before ‘}’ token                                                                                                                                               
     auto light{rack::ModuleLightWidget::create<T>({0, 0}, module, index)};                                                                                                                                      
                                                        ^                                                                                                                                                        
./src/modules/widget.h:39:57: error: expected ‘)’ before ‘,’ token                                                                                                                                               
     auto light{rack::ModuleLightWidget::create<T>({0, 0}, module, index)};                                                                                                                                      
                                                         ^
./src/modules/widget.h: In member function ‘void DHE::Widget::install_output(int, rack::Vec)’:
./src/modules/widget.h:46:29: error: ‘create’ is not a member of ‘rack::Port’
     auto output{rack::Port::create<T>({0, 0}, rack::Port::OUTPUT, module, index)};
                             ^~~~~~
./src/modules/widget.h:46:37: error: expected primary-expression before ‘>’ token
     auto output{rack::Port::create<T>({0, 0}, rack::Port::OUTPUT, module, index)};
                                     ^
./src/modules/widget.h:46:44: error: expected ‘;’ before ‘}’ token
     auto output{rack::Port::create<T>({0, 0}, rack::Port::OUTPUT, module, index)};
                                            ^
./src/modules/widget.h:46:45: error: expected ‘)’ before ‘,’ token
     auto output{rack::Port::create<T>({0, 0}, rack::Port::OUTPUT, module, index)};

./src/modules/widget.h: In member function ‘void DHE::Widget::install_param(int, rack::Vec, float, float, float)’:
./src/modules/widget.h:53:35: error: ‘create’ is not a member of ‘rack::ParamWidget’
     auto param{rack::ParamWidget::create<T>({0, 0}, module, index, low, high, initial)};
                                   ^~~~~~
./src/modules/widget.h:53:43: error: expected primary-expression before ‘>’ token
     auto param{rack::ParamWidget::create<T>({0, 0}, module, index, low, high, initial)};
                                           ^
./src/modules/widget.h:53:50: error: expected ‘;’ before ‘}’ token
     auto param{rack::ParamWidget::create<T>({0, 0}, module, index, low, high, initial)};
                                                  ^
./src/modules/widget.h:53:51: error: expected ‘)’ before ‘,’ token
     auto param{rack::ParamWidget::create<T>({0, 0}, module, index, low, high, initial)};
                                                   ^
./src/modules/widget.h: In member function ‘void DHE::Widget::install_screw(rack::Vec)’:
./src/modules/widget.h:60:31: error: ‘create’ is not a member of ‘rack::Widget’
     auto widget{rack::Widget::create<T>({0, 0})};
                               ^~~~~~
./src/modules/widget.h:60:39: error: expected primary-expression before ‘>’ token
     auto widget{rack::Widget::create<T>({0, 0})};
                                       ^
./src/modules/widget.h:60:46: error: expected ‘;’ before ‘}’ token
     auto widget{rack::Widget::create<T>({0, 0})};
                                              ^
src/plugin/dhe-modules.cpp: In function ‘rack::Model* DHE::createModel(std::__cxx11::string, TTag ...)’:
src/plugin/dhe-modules.cpp:15:23: error: ‘create’ is not a member of ‘rack::Model’
   return rack::Model::create<TModel, TWidget>("DHE-Modules", moduleSlug, moduleSlug, tags...);
                       ^~~~~~
src/plugin/dhe-modules.cpp:15:36: error: expected primary-expression before ‘,’ token
   return rack::Model::create<TModel, TWidget>("DHE-Modules", moduleSlug, moduleSlug, tags...);
                                    ^
src/plugin/dhe-modules.cpp:15:45: error: expected primary-expression before ‘>’ token
   return rack::Model::create<TModel, TWidget>("DHE-Modules", moduleSlug, moduleSlug, tags...);
                                             ^
src/plugin/dhe-modules.cpp:15:93: error: expected binary operator before ‘)’ token
   return rack::Model::create<TModel, TWidget>("DHE-Modules", moduleSlug, moduleSlug, tags...);
                                                                                             ^
make: *** [../../compile.mk:54: build/src/plugin/dhe-modules.cpp.o] Error 1

Am I doing something wrong? Your modules look cool and I want to try them out.

dhemery commented 6 years ago

I appreciate your interest.

You're probably just missing a few pieces of a pretty complex puzzle. Here are some of the missing pieces (none of which are obvious):

  1. The DHE-Modules master branch and dale-only/... branches use features from Rack's master branch. Those DHE-Modules branches won't compile against Rack v0.5 branch. That's most of what you're seeing in the compilation errors.

  2. If you really want to build against Rack v0.5, build the DHE-Modules v0.5.0 tag. It doesn't have Booster Stage, but it has Stage and Upstage, and they're plenty of fun on their own.

  3. Rack's master branch includes a new Rack build system--the "v0.6.0" build system. This new system allows building plugins from any directory, and not only from the Rack/plugins directory.

    I like to put my plugin code and the Rack code as subdirectories of the same parent directory. That's why RACK_DIR is defined as ../Rack in my Makefile.

  4. If you really want to build the plugin in the Rack/plugins directory, you can override my RACK_DIR setting by specifying a different value when you run make:

    make <target> RACK_DIR=../..
  5. Rack's Makefile includes allplugins and distplugins targets to build any plugins in the plugins subdirectory. If you want, you can build DHE-Modules that way. Put DHE-Modules into Rack/plugins, then on Rack's master branch run one of these commands:

    make allplugins RACK_DIR=../..
    make distplugins RACK_DIR=../..

    I would be happier if the Rack Makefile defined RACK_DIR automatically when it built those targets, but currently it does not. Maybe I'll open an issue on Rack.

  6. For my convenience (and maybe yours) I've added a run target in my Makefile. That will make dist, copy the plugin files to RACK_DIR/plugins, and run Rack.

    make run RACK_DIR=<path-to-rack>

Okay, that's probably an overwhelming amount of stuff to absorb. I hope something in there is helpful for you.

dhemery commented 6 years ago

After consulting with Andrew, I've adjusted my Makefile to make it more like other plugins' Makefiles. It should work for you now, as long as you build against Rack's master branch.

briansorahan commented 6 years ago

Thanks for the snappy turnaround @dhemery I will have to test this when I upgrade from Rack v0.5