Dewb / monome-rack

VCV Rack plugin for monome Eurorack modules
GNU General Public License v2.0
226 stars 13 forks source link

Update plugin for Rack 0.6 API #33

Closed Dewb closed 6 years ago

Dewb commented 6 years ago

Changes to the Rack API between 0.5 and 0.6: https://github.com/VCVRack/Rack/issues/258

After 0.6, there should be no additional API changes for 1.0. Not sure where I got that idea.

phdsg commented 6 years ago

as 0.6 is out now... when can we play with the grid again? :)

Dewb commented 6 years ago

The 0.6 branch should be Rack 0.6-compatible now. It builds on OSX and appears to work, but I haven't done a lot of testing. I'm away from my hardware grid right now, so I can't confirm the serialosc communication still works, but I have no reason to believe that any of the Rack 0.6 changes affected that aspect. Windows and Linux are also untested; since Rack has changed plugin Makefiles a bit there might be additional changes necessary for those platforms.

antoniograzioli commented 6 years ago

I am editing the makefile on windows, it doesn't compile as is (Slug and Rack_Dir missing)

phdsg commented 6 years ago

i don't have the problem with the Makefile.

win7 mingw64

but i'm getting a compile error:

g++  -Wsuggest-override -std=c++11 -o0 -Werror=implicit-function-declaration -Isrc -Isrc/common -Isrc/common/GridConnection -Isrc/virtualgrid -Isrc/whitewhale -Isrc/meadowphysics -Isrc/earthsea -Ilib/base64 -Ilib/oscpack -Ilib/serialosc -DSLUG=monome -fPIC -I../../include -I../../dep/include -DVERSION=0.6.0 -MMD -MP -g -O3 -march=nocona -ffast-math -fno-finite-math-only -Wall -Wextra -Wno-unused-parameter -DARCH_WIN -D_USE_MATH_DEFINES -c -o build/lib/base64/base64.cpp.o lib/base64/base64.cpp
cc1plus.exe: fatal error: build/lib/base64/base64.cpp.d: No such file or directory
compilation terminated.
make: *** [../../compile.mk:62: build/lib/base64/base64.cpp.o] Error 1
Dewb commented 6 years ago

Just pushed a change to the Makefile that restores the arch.mk include. Can you see if that changes the Windows build experience at all?

phdsg commented 6 years ago

not for me. getting the same error.

Dewb commented 6 years ago

What happens if you remove the line FLAGS := $(filter-out -MMD,$(FLAGS))?

phdsg commented 6 years ago

same. getting the feeling i might be on a different rack commit. been a few days since i last updated. and i saw some changes on the build system... lemme check.

phdsg commented 6 years ago

mhh, now that i updated to latest on the rack 0.6 branch i can't build rack anymore. rolling back... what commit of rack are you using?

Dewb commented 6 years ago

I built Rack/v0.6 with commit 2985005c8d006de4369b3d116bb2088521c85899. I do see some changes to plugin.mk in newer commits, I'll try building those.

phdsg commented 6 years ago

i'm now on https://github.com/VCVRack/Rack/commit/88be6a4ee4fb7883fa94677816c840ceddb089d6 latest doesn't work for me.

Dewb commented 6 years ago

I can build VCVRack/Rack@88be6a4 (but not the latest commit: https://github.com/VCVRack/Rack/issues/888)

Whenever I update the Rack tree, or switch branches, I tend to do the following to cut down on build issues:

make clean
cd dep
make clean
cd ..
git submodule sync
git submodule update --init --recursive
make
phdsg commented 6 years ago

ditto, although most times i only clean and remake deps if i see a change there in the commits.

Dewb commented 6 years ago

So with Rack 88be6a4 built, you're still getting the build/lib/base64/base64.cpp.d: No such file or directory error on monome-rack? Does the build/lib/base64 directory exist?

phdsg commented 6 years ago

yea, same error. directories exit but are empty. wanna see the complete make output?

Dewb commented 6 years ago

Are you building inside VS Code? If you are, try removing the -j4 from the build command in .vscode/tasks.json (or if you're building from the command line and providing the -j flag, remove it there.)

phdsg commented 6 years ago

nope, no vs, just make on the msys2 terminal and i think -j isn't set.

Dewb commented 6 years ago

Okay, can you clone fresh copies of Rack and monome-rack and paste the full make output for monome-rack?

phdsg commented 6 years ago

as rack's 0.6 branch is still not working for me i went for the 0.6.0 tag. result is the same as in all the previous tries.

here's the full log:

$ make
cd firmware && make -f whitewhale.mk
make[1]: Entering directory '/h/devel/vcv/Rack-new/plugins/monome/firmware'
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/whitewhale/src/main.c.o whitewhale/src/main.c
whitewhale/src/main.c: In function 'handler_PollADC':
whitewhale/src/main.c:655:14: warning: passing argument 1 of 'adc_convert' from incompatible pointer type [-Wincompatible-pointer-types]
  adc_convert(&adc);
              ^
In file included from whitewhale/src/main.c:29:0:
mock_hardware/stubs/adc.h:4:6: note: expected 'u16 * {aka short unsigned int *}' but argument is of type 'u16 (*)[4] {aka short unsigned int (*)[4]}'
 void adc_convert(u16* dst);
      ^~~~~~~~~~~
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/whitewhale/libavr32/src/events.c.o whitewhale/libavr32/src/events.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/whitewhale/libavr32/src/timers.c.o whitewhale/libavr32/src/timers.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/whitewhale/libavr32/src/monome.c.o whitewhale/libavr32/src/monome.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/whitewhale/libavr32/src/util.c.o whitewhale/libavr32/src/util.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/mock_hardware/adapter.c.o mock_hardware/adapter.c
mock_hardware/adapter.c: In function 'ftdi_read':
mock_hardware/adapter.c:239:67: warning: passing argument 3 of 'hardware_readSerial_internal' from incompatible pointer type [-Wincompatible-pointer-types]
     hardware_readSerial_internal(FTDI_BUS, &current_ftdi_message, &current_ftdi_message_length);
                                                                   ^
In file included from mock_hardware/adapter.c:2:0:
mock_hardware/mock_hardware.h:32:6: note: expected 'uint32_t * {aka unsigned int *}' but argument is of type 'u8 * {aka unsigned char *}'
 void hardware_readSerial_internal(serial_bus_t bus, uint8_t** pbuf, uint32_t* pcount);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iwhitewhale/libavr32/src -Iwhitewhale/libavr32/conf -Iwhitewhale/libavr32/conf/trilogy   -c -o ../build/firmware/mock_hardware/mock_hardware.c.o mock_hardware/mock_hardware.c
mock_hardware/mock_hardware.c: In function 'hardware_declareNVRAM':
mock_hardware/mock_hardware.c:285:15: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     nvram_ptr = ptr;
               ^
mock_hardware/mock_hardware.c: In function 'hardware_declareVRAM':
mock_hardware/mock_hardware.c:302:14: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     vram_ptr = ptr;
              ^
g++ -o ../build/firmware/whitewhale.dll ../build/firmware/whitewhale/src/main.c.o ../build/firmware/whitewhale/libavr32/src/events.c.o ../build/firmware/whitewhale/libavr32/src/timers.c.o ../build/firmware/whitewhale/libavr32/src/monome.c.o ../build/firmware/whitewhale/libavr32/src/util.c.o ../build/firmware/mock_hardware/adapter.c.o ../build/firmware/mock_hardware/mock_hardware.c.o -shared
make[1]: Leaving directory '/h/devel/vcv/Rack-new/plugins/monome/firmware'
cd firmware && make -f meadowphysics.mk
make[1]: Entering directory '/h/devel/vcv/Rack-new/plugins/monome/firmware'
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Imeadowphysics/libavr32/src -Imeadowphysics/libavr32/conf -Imeadowphysics/libavr32/conf/trilogy   -c -o ../build/firmware/meadowphysics/src/main.c.o meadowphysics/src/main.c
meadowphysics/src/main.c: In function 'handler_PollADC':
meadowphysics/src/main.c:421:14: warning: passing argument 1 of 'adc_convert' from incompatible pointer type [-Wincompatible-pointer-types]
  adc_convert(&adc);
              ^
In file included from meadowphysics/src/main.c:23:0:
mock_hardware/stubs/adc.h:4:6: note: expected 'u16 * {aka short unsigned int *}' but argument is of type 'u16 (*)[4] {aka short unsigned int (*)[4]}'
 void adc_convert(u16* dst);
      ^~~~~~~~~~~
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Imeadowphysics/libavr32/src -Imeadowphysics/libavr32/conf -Imeadowphysics/libavr32/conf/trilogy   -c -o ../build/firmware/meadowphysics/libavr32/src/events.c.o meadowphysics/libavr32/src/events.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Imeadowphysics/libavr32/src -Imeadowphysics/libavr32/conf -Imeadowphysics/libavr32/conf/trilogy   -c -o ../build/firmware/meadowphysics/libavr32/src/timers.c.o meadowphysics/libavr32/src/timers.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Imeadowphysics/libavr32/src -Imeadowphysics/libavr32/conf -Imeadowphysics/libavr32/conf/trilogy   -c -o ../build/firmware/meadowphysics/libavr32/src/monome.c.o meadowphysics/libavr32/src/monome.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Imeadowphysics/libavr32/src -Imeadowphysics/libavr32/conf -Imeadowphysics/libavr32/conf/trilogy   -c -o ../build/firmware/meadowphysics/libavr32/src/util.c.o meadowphysics/libavr32/src/util.c
g++ -o ../build/firmware/meadowphysics.dll ../build/firmware/meadowphysics/src/main.c.o ../build/firmware/meadowphysics/libavr32/src/events.c.o ../build/firmware/meadowphysics/libavr32/src/timers.c.o ../build/firmware/meadowphysics/libavr32/src/monome.c.o ../build/firmware/meadowphysics/libavr32/src/util.c.o ../build/firmware/mock_hardware/adapter.c.o ../build/firmware/mock_hardware/mock_hardware.c.o -shared
make[1]: Leaving directory '/h/devel/vcv/Rack-new/plugins/monome/firmware'
cd firmware && make -f earthsea.mk
make[1]: Entering directory '/h/devel/vcv/Rack-new/plugins/monome/firmware'
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/src/main.c.o earthsea/src/main.c
earthsea/src/main.c: In function 'handler_MonomeConnect':
earthsea/src/main.c:837:14: warning: passing argument 1 of 'adc_convert' from incompatible pointer type [-Wincompatible-pointer-types]
  adc_convert(&adc);
              ^
In file included from earthsea/src/main.c:25:0:
mock_hardware/stubs/adc.h:4:6: note: expected 'u16 * {aka short unsigned int *}' but argument is of type 'u16 (*)[4] {aka short unsigned int (*)[4]}'
 void adc_convert(u16* dst);
      ^~~~~~~~~~~
earthsea/src/main.c: In function 'handler_PollADC':
earthsea/src/main.c:871:14: warning: passing argument 1 of 'adc_convert' from incompatible pointer type [-Wincompatible-pointer-types]
  adc_convert(&adc);
              ^
In file included from earthsea/src/main.c:25:0:
mock_hardware/stubs/adc.h:4:6: note: expected 'u16 * {aka short unsigned int *}' but argument is of type 'u16 (*)[4] {aka short unsigned int (*)[4]}'
 void adc_convert(u16* dst);
      ^~~~~~~~~~~
earthsea/src/main.c: In function 'handler_MidiPollADC':
earthsea/src/main.c:2200:14: warning: passing argument 1 of 'adc_convert' from incompatible pointer type [-Wincompatible-pointer-types]
  adc_convert(&adc);
              ^
In file included from earthsea/src/main.c:25:0:
mock_hardware/stubs/adc.h:4:6: note: expected 'u16 * {aka short unsigned int *}' but argument is of type 'u16 (*)[4] {aka short unsigned int (*)[4]}'
 void adc_convert(u16* dst);
      ^~~~~~~~~~~
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/arp.c.o earthsea/libavr32/src/arp.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/euclidean/data.c.o earthsea/libavr32/src/euclidean/data.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/euclidean/euclidean.c.o earthsea/libavr32/src/euclidean/euclidean.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/events.c.o earthsea/libavr32/src/events.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/monome.c.o earthsea/libavr32/src/monome.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/notes.c.o earthsea/libavr32/src/notes.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/random.c.o earthsea/libavr32/src/random.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/timers.c.o earthsea/libavr32/src/timers.c
cc -DNULL=0 -o0 -D__AVR32_UC3B0256__ -fPIC -g -Werror=implicit-function-declaration -Imock_hardware -Imock_hardware/stubs -Iearthsea/libavr32/src -Iearthsea/libavr32/src/usb/midi -Iearthsea/libavr32/conf -Iearthsea/libavr32/conf/trilogy   -c -o ../build/firmware/earthsea/libavr32/src/util.c.o earthsea/libavr32/src/util.c
g++ -o ../build/firmware/earthsea.dll ../build/firmware/earthsea/src/main.c.o ../build/firmware/earthsea/libavr32/src/arp.c.o ../build/firmware/earthsea/libavr32/src/euclidean/data.c.o ../build/firmware/earthsea/libavr32/src/euclidean/euclidean.c.o ../build/firmware/earthsea/libavr32/src/events.c.o ../build/firmware/earthsea/libavr32/src/monome.c.o ../build/firmware/earthsea/libavr32/src/notes.c.o ../build/firmware/earthsea/libavr32/src/random.c.o ../build/firmware/earthsea/libavr32/src/timers.c.o ../build/firmware/earthsea/libavr32/src/util.c.o ../build/firmware/mock_hardware/adapter.c.o ../build/firmware/mock_hardware/mock_hardware.c.o -shared
make[1]: Leaving directory '/h/devel/vcv/Rack-new/plugins/monome/firmware'
g++  -Wsuggest-override -std=c++11 -o0 -Werror=implicit-function-declaration -Isrc -Isrc/common -Isrc/common/GridConnection -Isrc/virtualgrid -Isrc/whitewhale -Isrc/meadowphysics -Isrc/earthsea -Ilib/base64 -Ilib/oscpack -Ilib/serialosc  -DSLUG=monome -fPIC -I../../include -I../../dep/include -DVERSION=0.6.0 -MMD -MP -g -O3 -march=nocona -ffast-math -fno-finite-math-only -Wall -Wextra -Wno-unused-parameter -DARCH_WIN -D_USE_MATH_DEFINES -c -o build/lib/base64/base64.cpp.o lib/base64/base64.cpp
cc1plus.exe: fatal error: build/lib/base64/base64.cpp.d: No such file or directory
compilation terminated.
make: *** [../../compile.mk:62: build/lib/base64/base64.cpp.o] Error 1

also getting the same error on debian9.

Dewb commented 6 years ago

Ah, you might have out-of-sync submodules. Can you run and paste the output of git submodule status --recursive and then try doing a git submodule sync && git submodule update --init --recursive and see if that fixes it?

phdsg commented 6 years ago

i'm sure i already did that. did it again. same result :( tried again, using the Rack-SDK... same thing.

phdsg commented 6 years ago

phew finally, after staring at the command line for a while i notice an odd option-flag -o0 and i removed it from the Makefile for another try. and it builds and loads...

now for some run-tests :)

phdsg commented 6 years ago

ok. with the rack-sdk i did make dist and copied the content to my downloaded rack-0.6 installation. modules load fine and i see the hardware-grid in the menu.

firmwares don't load though.

first thing i noticed in rack's log.txt was that the modules try to load the firmware from a plugin-dir called monome-rack, which doesn't exit as i renamed the plugin-dir to monome, matching the slug in the makefile (requirement for 0.6 plugins).

now, instead of renaming the plugin-dir i changed the slug to monome-rack and rebuilt...

still not loading the firmware although the paths match now.

a look at the dist folder shows that it included the firmware instead of build/firmware.

copying the .dll files from the build directory to the expected locations also didn't solve it.

Dewb commented 6 years ago

Great! I’m home again and will have time to look at the Windows build later today. Good catch on the optimization flag. I would try to make it work with the old build process rather than the rack-SDK build first.

dizzisound commented 6 years ago

@Dewb @phdsg Hi, I made some testing with the build on Windows, here my notes.

Checking out branch 0.6, the build completes both against Rack build and Rack-SDK, with the following adjustments:

Once the build compiled, the plugin works well when I start Rack with make run from the Mingw64 shell. Indeed, when I move the monome (or monome-rack) folder in the dist, to my _{userhome}\Documents\Rack\plugins folder and launch the installed version of Rack, the modules load successfully, but the connection to the virtual grids don't work. I found that Rack looks for the firmware libraries in this path: plugins/monome-rack/build/firmware, relative to its execution folder (which is C:\Program Files\VCV\Rack in my system). If I recreate the above mentioned path and move there the dll's from the firmware folder of the distribution package, the grids connect and the plugin starts working fully.

Dewb commented 6 years ago

Thanks for the feedback! I don't think it's necessary for the plugin Makefile to copy FLAGS to CXXFLAGS (the Rack compile.mk should handle that already.) And I've moved the firmware files into the res folder to keep things tidy.

Aside from that, all of the above fixes have been applied, and the 0.6 branch of the plugin should build and run correctly with the current VCVRack 0.6 head on Windows, with either full Rack or Rack SDK builds. I'm going to test OSX as well, and if no problems are spotted over the weekend I'll merge the 0.6 branch to master.

Dewb commented 6 years ago

0.6 branch has been merged to master in #35.