Chowdhury-DSP / ChowDSP-VCV-Secrets

Shhhh... Don't tell anyone!
GNU General Public License v3.0
2 stars 0 forks source link

Build failure on Windows platform with Rack toolchain #1

Closed cschol closed 2 years ago

cschol commented 2 years ago

Looks like a linker error on the Windows platform:

x86_64-w64-mingw32-g++ -o plugin.dll build/src/plugin.cpp.o build/src/MetalFace/MetalFace.cpp.o build/src/ChowBell/ChowBell.cpp.o libs/build-libs/libchowdsp.a  -shared -L/home/build/rack-plugin-toolchain/Rack-SDK-win -lRack -static-libstdc++ 
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/MetalFace/MetalFace.cpp.o: in function `chowdsp::Upsampler<float, chowdsp::ButterworthFilter<8, (chowdsp::ButterworthFilterType)0, float> >::process(float const*, float*, int, int)':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Resampling/chowdsp_Upsampler.h:60: undefined reference to `chowdsp_juce::detail::FloatVectorOperationsBase<float, int>::multiply(float*, float, int)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/MetalFace/MetalFace.cpp.o: in function `chowdsp::Upsampler<float, chowdsp::ButterworthFilter<8, (chowdsp::ButterworthFilterType)0, float> >::prepare(juce::dsp::ProcessSpec, int)':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Resampling/chowdsp_Upsampler.h:21: undefined reference to `chowdsp::Buffer<float>::setMaxSize(int, int)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/MetalFace/MetalFace.cpp.o: in function `chowdsp::Upsampler<float, chowdsp::ButterworthFilter<8, (chowdsp::ButterworthFilterType)0, float> >::reset()':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Resampling/chowdsp_Upsampler.h:35: undefined reference to `chowdsp::Buffer<float>::clear()'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/MetalFace/MetalFace.cpp.o: in function `chowdsp::Downsampler<float, chowdsp::ButterworthFilter<8, (chowdsp::ButterworthFilterType)0, float> >::prepare(juce::dsp::ProcessSpec, int)':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Resampling/chowdsp_Downsampler.h:23: undefined reference to `chowdsp::Buffer<float>::setMaxSize(int, int)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/MetalFace/MetalFace.cpp.o: in function `chowdsp::Downsampler<float, chowdsp::ButterworthFilter<8, (chowdsp::ButterworthFilterType)0, float> >::reset()':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Resampling/chowdsp_Downsampler.h:37: undefined reference to `chowdsp::Buffer<float>::clear()'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::ADAAWaveshaper<float>::initialise<chowdsp::ADAATanhClipper<float>::ADAATanhClipper(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#1}, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#2}, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#3}>(chowdsp::ADAATanhClipper<float>::ADAATanhClipper(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#1}&&, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#2}&&, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#3}&&, float, float, int)::{lambda()#1}::operator()() const':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_waveshapers/Waveshapers/chowdsp_ADAAWaveshaper.h:48: undefined reference to `chowdsp::LookupTableTransform<double>::initialise(std::function<double (double)> const&, double, double, unsigned long long)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::ADAAWaveshaper<float>::initialise<chowdsp::ADAATanhClipper<float>::ADAATanhClipper(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#1}, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#2}, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#3}>(chowdsp::ADAATanhClipper<float>::ADAATanhClipper(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#1}&&, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#2}&&, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#3}&&, float, float, int)::{lambda()#2}::operator()() const':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_waveshapers/Waveshapers/chowdsp_ADAAWaveshaper.h:54: undefined reference to `chowdsp::LookupTableTransform<double>::initialise(std::function<double (double)> const&, double, double, unsigned long long)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::ADAAWaveshaper<float>::initialise<chowdsp::ADAATanhClipper<float>::ADAATanhClipper(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#1}, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#2}, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#3}>(chowdsp::ADAATanhClipper<float>::ADAATanhClipper(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#1}&&, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#2}&&, chowdsp::ADAATanhClipper<float>::LookupTableCache(chowdsp::LookupTableCache*, float, int)::{lambda(auto:1)#3}&&, float, float, int)::{lambda()#3}::operator()() const':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_waveshapers/Waveshapers/chowdsp_ADAAWaveshaper.h:60: undefined reference to `chowdsp::LookupTableTransform<double>::initialise(std::function<double (double)> const&, double, double, unsigned long long)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::SquareWave<float>::prepare(juce::dsp::ProcessSpec const&)':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Sources/chowdsp_SquareWave.cpp:16: undefined reference to `chowdsp::Buffer<float>::setMaxSize(int, int)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Sources/chowdsp_SquareWave.cpp:16: undefined reference to `chowdsp::Buffer<float>::setMaxSize(int, int)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::LookupTableTransform<float>::LookupTableTransform(std::function<float (float)> const&, float, float, unsigned long long)':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_data_structures/DataStructures/chowdsp_LookupTableTransform.h:35: undefined reference to `chowdsp_juce::dsp::LookupTable<float>::LookupTable()'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_data_structures/DataStructures/chowdsp_LookupTableTransform.h:36: undefined reference to `chowdsp::LookupTableTransform<float>::initialise(std::function<float (float)> const&, float, float, unsigned long long)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::LookupTableTransform<double>::LookupTableTransform()':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_data_structures/DataStructures/chowdsp_LookupTableTransform.h:19: undefined reference to `chowdsp_juce::dsp::LookupTable<double>::LookupTable()'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_data_structures/DataStructures/chowdsp_LookupTableTransform.h:19: undefined reference to `chowdsp_juce::dsp::LookupTable<double>::LookupTable()'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_data_structures/DataStructures/chowdsp_LookupTableTransform.h:19: undefined reference to `chowdsp_juce::dsp::LookupTable<double>::LookupTable()'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: build/src/ChowBell/ChowBell.cpp.o: in function `chowdsp::SquareWave<float>::prepare(juce::dsp::ProcessSpec const&)':
/home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Sources/chowdsp_SquareWave.cpp:16: undefined reference to `chowdsp::Buffer<float>::setMaxSize(int, int)'
/home/build/rack-plugin-toolchain/local/x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/build/plugin-src/libs/chowdsp_utils/modules/dsp/chowdsp_dsp_utils/Sources/chowdsp_SquareWave.cpp:16: undefined reference to `chowdsp::Buffer<float>::setMaxSize(int, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK-win/compile.mk:62: plugin.dll] Error 1
make[2]: Leaving directory '/home/build/plugin-src'
make[1]: *** [Makefile:165: plugin-build-win] Error 2
make[1]: Leaving directory '/home/build/rack-plugin-toolchain'
make: *** [Makefile:173: plugin-build] Error 2
make: *** [Makefile:261: docker-plugin-build] Error 2
jatinchowdhury18 commented 2 years ago

Thanks for checking this out! All the missing objects should be compiled into libchowdsp.a, which does look like it's getting linked in. That library should be built during the make dep step. Would it be possible to share the logs from that step?

cschol commented 2 years ago

Here is the make dep log from the Windows build:

make: warning: -j8 forced in submake: resetting jobserver mode.
cd /home/build/plugin-src && make clean
make[1]: Entering directory '/home/build/plugin-src'
rm -rfv build plugin.dll dist
make[1]: Leaving directory '/home/build/plugin-src'
cd /home/build/plugin-src && make cleandep
make[1]: Entering directory '/home/build/plugin-src'
rm -rfv dep
removed directory 'dep'
make[1]: Leaving directory '/home/build/plugin-src'
cd /home/build/plugin-src && make dep
make[1]: Entering directory '/home/build/plugin-src'
echo /home/build/plugin-src
/home/build/plugin-src
cd libs && cmake -G 'MSYS Makefiles' -DCMAKE_INSTALL_PREFIX="/home/build/plugin-src/dep" -DCMAKE_INSTALL_LIBDIR=lib -Bbuild-libs
CMake Error: Could not create named generator MSYS Makefiles

Generators
* Unix Makefiles               = Generates standard UNIX makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

make[1]: *** [libs/libs.mk:21: libs/build-libs/libchowdsp.a] Error 1
make[1]: Leaving directory '/home/build/plugin-src'
make: *** [Makefile:164: plugin-build-win] Error 2
make: *** [Makefile:253: docker-plugin-build-win] Error 2
cschol commented 2 years ago

The other problem is that Rack's make depclean step does not remove the libchowdsp.a.

When building multiple platforms, the first platform will build libchowdsp.a (in this case macOS) and the subsequent platform (in this case Windows) will not rebuild it, but try to use the previously built one.

It is better to install the built library into the dep directory (via make install) and link it in from there. Then the make depclean step will ensure to remove the build artifact before building the next platform.

EDIT: This does not fix the above problem with the library not being built on Windows.

jatinchowdhury18 commented 2 years ago

Gotcha, that makes sense. I'll switch the library make command to use make install.

I'm not sure I understand how to fix the library build failure. Using 'MSYS Makefiles' as the CMake generator is being chosen by Rack's environment, but I guess I should override that with "Unix Makefiles"? It seems a little odd to have to override Rack's chosen generator.

cschol commented 2 years ago

The MSYS Makefiles generator issue is actually an issue in dep.mk that will be fixed in the next Rack SDK release. Upon investigation, the current implementation only works in the actual native MSYS shell. It does not work in the cross-compilation environment of the rack-plugin-toolchain. So far, noone seem to have used cmake for building dependencies, so we didn't notice. I have verified that with that SDK fix, the Windows build works correctly on its own.

Now we just need to manage the dep directory removal as discussed above and we should be good.

jatinchowdhury18 commented 2 years ago

Cool, good to know! I think I've got make cleandep working as expected now, so hopefully everything will be good to go for making builds.

cschol commented 2 years ago

Confirmed that latest changes work and all platforms build successfully. Closing issue. Thank you!