README.txt (10505B)
1 How to compile ZynAddSubFX on Windows MinGW64 MSYS2: 2 3 Tested on Windows 10 64-bit at commit 4b95ad25aebe87c79edfcfde86bd03ac46031d48 on 2016-10-02 4 5 This is an unofficial way to get ZynAddSubFX running as a 64-bit VST plugin 6 on Windows. Following this method will modify the Zyn source code in ways 7 which may break Linux compatibility. Or not, I didn't test it on Linux 8 after making the changes. 9 10 The VST plugin doesn't have a UI, but we can build the zynaddsubfx-ext-gui, 11 which can be used to connect to your running Zyn VST instances, providing 12 that familiar Zyn UI. It works quite well, although it would be better if 13 the VST plugins could just open their own UI instead. 14 15 16 Download and install MSYS2 64-bit ( https://msys2.github.io ) 17 18 Open an MSYS2 shell. 19 20 21 Install some dependencies with pacman: 22 23 pacman -S --force mingw-w64-x86_64-toolchain git make gcc mingw-w64-x86_64-fftw diffutils mingw-w64-i686-toolchain mingw-w64-x86_64-fltk 24 25 26 Make a folder to hold your downloads: 27 28 mkdir -p ~/Downloads 29 30 31 Close your MSYS2 shell and open a MinGW64 MSYS2 shell. 32 33 cd ~/Downloads 34 35 Enable multithreaded compiling: 36 37 export MAKE="make -j" 38 39 Install some source dependencies: 40 41 git clone https://github.com/sharpee/mxml 42 cd mxml 43 ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --prefix=/mingw64 CFLAGS=-D__CRT__NO_INLINE 44 make -D__CRT__NO_INLINE 45 make install 46 47 cd ~/Downloads 48 git clone https://github.com/guysherman/MINGW-packages.git 49 cd MINGW-packages 50 git checkout guypkgs 51 cd mingw-w64-liblo && makepkg-mingw --install && cd .. 52 53 54 Add the MinGW and MSYS2 bin dirs to your Windows PATH: 55 56 Open System Properties, click Environment Variables, 57 Then edit the system Path variable. Add these two paths in this order: 58 59 C:\msys64\mingw64\bin 60 C:\msys64\usr\bin 61 62 63 Clone the Zyn git repo: 64 65 cd ~/Downloads 66 git clone https://github.com/zynaddsubfx/zynaddsubfx.git 67 cd zynaddsubfx 68 git submodule update --init --recursive 69 70 71 Fix some of Zyn's CMake build scripts: 72 73 sed -i "s/string(STRIP \${FLTK_LDFLAGS} FLTK_LIBRARIES)/string(STRIP \"\${FLTK_LDFLAGS}\" FLTK_LIBRARIES)/g" src/CMakeLists.txt 74 sed -i "s/target_link_libraries(zynaddsubfx_gui \${FLTK_LIBRARIES})/target_link_libraries(zynaddsubfx_gui \${FLTK_BASE_LIBRARY})/g" src/UI/CMakeLists.txt 75 sed -i "s/install(TARGETS ZynAddSubFX_vst LIBRARY/install(TARGETS ZynAddSubFX_vst RUNTIME/g" src/Plugin/ZynAddSubFX/CMakeLists.txt 76 cat src/Plugin/ZynAddSubFX/CMakeLists.txt | tr '\n' '\r' | sed -e "s/elseif(FltkGui)\r\r# UI Enabled using FLTK: external only\radd_library(ZynAddSubFX_lv2 SHARED\r \${CMAKE_SOURCE_DIR}\/src\/globals.cpp\r \${CMAKE_SOURCE_DIR}\/src\/UI\/ConnectionDummy.cpp\r \${CMAKE_SOURCE_DIR}\/DPF\/distrho\/DistrhoPluginMain.cpp\r ZynAddSubFX.cpp)/elseif(FltkGui)\r\r# UI Enabled using FLTK: external only\r#\[\[\radd_library(ZynAddSubFX_lv2 SHARED\r \${CMAKE_SOURCE_DIR}\/src\/globals.cpp\r \${CMAKE_SOURCE_DIR}\/src\/UI\/ConnectionDummy.cpp\r \${CMAKE_SOURCE_DIR}\/DPF\/distrho\/DistrhoPluginMain.cpp\r ZynAddSubFX.cpp)\r\]\]\r/g" | tr '\r' '\n' > src/Plugin/ZynAddSubFX/CMakeLists.txt 77 cat src/Plugin/ZynAddSubFX/CMakeLists.txt | tr '\n' '\r' | sed -e "s/set_target_properties(ZynAddSubFX_lv2 PROPERTIES COMPILE_DEFINITIONS \"DISTRHO_PLUGIN_TARGET_LV2\")\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY \"lv2\")\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES OUTPUT_NAME \"ZynAddSubFX\")\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES PREFIX \"\")/#\[\[\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES COMPILE_DEFINITIONS \"DISTRHO_PLUGIN_TARGET_LV2\")\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY \"lv2\")\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES OUTPUT_NAME \"ZynAddSubFX\")\rset_target_properties(ZynAddSubFX_lv2 PROPERTIES PREFIX \"\")\r\]\]/g" | tr '\r' '\n' > src/Plugin/ZynAddSubFX/CMakeLists.txt 78 cat src/Plugin/ZynAddSubFX/CMakeLists.txt | tr '\n' '\r' | sed -e "s/target_link_libraries(ZynAddSubFX_lv2 zynaddsubfx_core \${OS_LIBRARIES} \${LIBLO_LIBRARIES}\r \${PLATFORM_LIBRARIES})/#\[\[\rtarget_link_libraries(ZynAddSubFX_lv2 zynaddsubfx_core \${OS_LIBRARIES} \${LIBLO_LIBRARIES}\r \${PLATFORM_LIBRARIES})\r\]\]/g" | tr '\r' '\n' > src/Plugin/ZynAddSubFX/CMakeLists.txt 79 sed -i "s/install(TARGETS ZynAddSubFX_lv2 LIBRARY DESTINATION \${PluginLibDir}\/lv2\/ZynAddSubFX.lv2\/)/#install(TARGETS ZynAddSubFX_lv2 LIBRARY DESTINATION \${PluginLibDir}\/lv2\/ZynAddSubFX.lv2\/)/g" src/Plugin/ZynAddSubFX/CMakeLists.txt 80 cat src/Plugin/ZynAddSubFX/CMakeLists.txt | tr '\n' '\r' | sed -e "s/add_library(ZynAddSubFX_lv2_ui SHARED\r \${CMAKE_SOURCE_DIR}\/DPF\/distrho\/DistrhoUIMain.cpp\r ZynAddSubFX-UI.cpp)/#\[\[\radd_library(ZynAddSubFX_lv2_ui SHARED\r \${CMAKE_SOURCE_DIR}\/DPF\/distrho\/DistrhoUIMain.cpp\r ZynAddSubFX-UI.cpp)\r\]\]/g" | tr '\r' '\n' > src/Plugin/ZynAddSubFX/CMakeLists.txt 81 82 83 84 Fix some other files which cause the Zyn build to fail on MinGW: 85 86 sed -i "s/lstat/stat/g" src/Misc/BankDb.cpp 87 sed -i "s/if(ret != -1)/\/\/if(ret != -1)/g" src/Misc/BankDb.cpp 88 sed -i "s/time = st.st_mtim.tv_sec;/\/\/time = st.st_mtim.tv_sec;/g" src/Misc/BankDb.cpp 89 sed -i "s/printf(\"desired mask = %x\\\n\", mask);/\/\/printf(\"desired mask = %x\\\n\", mask);/g" src/Misc/MiddleWare.cpp 90 sed -i "s/#include <err.h>/\/\/#include <err.h>/g" src/main.cpp 91 cat src/UI/MasterUI.fl | tr '\n' '\r' | sed -e "s/decl {\\\#include <stdlib.h>} {public local\r}/decl {\\\#undef WIN32\r\\\#include <FL\/x.H>\r\\\#define WIN32} {public local\r}\r\rdecl {\\\#include <stdlib.h>} {public local\r}\r/g" | tr '\r' '\n' > src/UI/MasterUI.fl 92 sed -i "s/index/strchr/g" src/UI/Fl_Osc_Tree.H 93 94 95 Make a build folder: 96 97 mkdir -p build 98 cd build 99 100 101 Download and install CMake 64-bit ( https://cmake.org/download/ ) 102 103 During the install, choose "Add CMake to the system PATH for all users", 104 and "Create CMake Desktop Icon". 105 106 Open CMake-gui, set the source code location to: 107 108 C:\msys64\home\<your username>\Downloads\zynaddsubfx 109 110 Set the build location to: 111 112 C:\msys64\home\<your username>\Downloads\zynaddsubfx\build 113 114 Click Configure, then choose the MinGW Makefiles generator, click Finish. 115 116 It will give an error about sh.exe being in your path. That's okay, 117 Click Configure again. It should succeed and say "Configuring done" at the 118 bottom. 119 120 Uncheck OssEnable and change GuiModule to "fltk" if it isn't set on that. 121 122 Click Configure. If it fails, fix any errors and then repeat until it 123 succeeds. 124 125 Click Generate. 126 127 128 Compile and install ZynAddSubFX: 129 130 MSYSTEM='' 131 mingw32-make 132 133 134 It will error out with: 135 C:/msys64-zyn/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llo 136 137 So we will patch some CMake output files (there must be a better way, but I 138 couldn't find where all the -llo were coming from): 139 140 sed -i "s/-llo/-l:liblo.dll.a/g" src/Plugin/ZynAddSubFX/CMakeFiles/ZynAddSubFX_lv2.dir/linklibs.rsp 141 sed -i "s/-llo/-l:liblo.dll.a/g" src/Plugin/ZynAddSubFX/CMakeFiles/ZynAddSubFX_vst.dir/linklibs.rsp 142 sed -i "s/-llo/-l:liblo.dll.a/g" src/CMakeFiles/zynaddsubfx.dir/linklibs.rsp 143 sed -i "s/-llo/-l:liblo.dll.a/g" src/UI/CMakeFiles/zynaddsubfx-ext-gui.dir/linklibs.rsp 144 145 Add a missing folder and compile again: 146 147 mkdir -p src/Plugin/ZynAddSubFX/lv2 148 mingw32-make 149 150 If the build failed, fix any errors until it succeeds (and please tell me 151 about them), and then copy your shiny new Zyn VST plugin dll into the spot 152 where your DAW wants it. For Ardour: 153 154 copy C:\msys64\home\<your username>\Downloads\zynaddsubfx\build\src\Plugin\ZynAddSubFX\ZynAddSubFX.dll 155 to 156 C:\Users\<your username>\Documents\Plugins\VST 157 158 159 Make a symlink to the instruments that come with Zyn, so it can find them: 160 161 cd ~ 162 ln -s ~/Downloads/zynaddsubfx/instruments/banks 163 164 165 If it all worked, OMG, You can use Zyn on Windows now! But how to use it?: 166 167 I've only tried it in Ardour, so I can't speak for other DAWs, but to use 168 it in Ardour, you need to launch Ardour from a terminal, make a new session, 169 add a MIDI track, then open Preferences. 170 171 Go to Plugins -> VST, check "Scan for [new] VST Plugins on Application Start" 172 and make sure Verbose Plugin Scan is checked. 173 174 Now click "Scan for Plugins", then go back to the Editor or Mixer view and 175 you should be able to add your new ZynAddSubFX VST plugin to the MIDI track. 176 177 Once added, you should be able to play the default sine wave synth and hear 178 the audio from it. But you'll probably notice there's no UI. We need the UI! 179 180 181 Enter zynaddsubfx-ext-gui. This is a familiar FLTK frontend to Zyn which 182 can connect to a Zyn VST instance. To launch it, do this in the MinGW64 183 MSYS2 shell: 184 185 cd ~/Downloads/zynaddsubfx/build/src/UI 186 187 Now take a look at the terminal that you're running your DAW in, and look 188 for some output that looks like "lo server running on <some number>". 189 190 You will see two lines like that which are from when you added the Zyn VST 191 plugin to your MIDI track. We need the number from the second line. 192 193 Now launch the ext-gui pointing at your VST instance: 194 195 ./zynaddsubfx-ext-gui.exe osc.udp://localhost:<the second number> 196 197 The GUI should open, and if you got the number right, some of the knobs 198 in the GUI should be turned up, and then you'll be able to control the VST 199 with the GUI, and also the GUI with the VST. 200 201 If the number was wrong, all the knobs in the GUI will be turned down, and 202 everything will be set to empty or disabled values. In that case, check the 203 terminal output again, and try a different number. 204 205 In Ardour, sometimes the line with the correct number won't show until the 206 next time you save your session after adding a VST instance of Zyn. 207 208 You can totally use as many Zyn VST instances as you want and attach GUIs 209 to each of them. The order of the numbers printed in the terminal should 210 reflect either the order the plugins were added in, or maybe the order of 211 the tracks they are in, remember though that the first line with the number 212 which shows in the terminal is not valid, so connect your GUIs starting 213 from the second number onwards. 214 215 216 Yay, Zyn 64-bit VST in Windows! That was hard! Let me know how it goes, and 217 if this process breaks in the future, I'll happily accept pull requests to 218 fix it. 219 220 ~Jeremy Carter <Jeremy@JeremyCarter.ca> 2016