dhemery / DHE-Modules

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

I can build most plugins, but not yours #25

Closed squinkylabs closed 4 years ago

squinkylabs commented 4 years ago
In file included from plugin/Plugin.cpp:30:
plugin/modules/xycloid/Xycloid.h:50:10: warning: 'virtual void dhe::xycloid::Xycloid::process(const rack::engine::Module::ProcessArgs&)' can be marked override [-Wsuggest-override]
   50 |     void process(ProcessArgs const &args) {
      |          ^~~~~~~
g++ -o plugin.dll build/plugin/Plugin.cpp.o -shared -L../.. -lRack
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/plugin/Plugin.cpp.o:Plugin.cpp:(.rdata$.refptr._ZN3dhe7xycloid7Xycloid16wobbleDepthRangeE[.refptr._ZN3dhe7xycloid7Xycloid16wobbleDepthRangeE]+0x0): undefined reference to `dhe::xycloid::Xycloid::wobbleDepthRange'
collect2.exe: error: ld returned 1 exit status
dhemery commented 4 years ago

I don’t have Windows, so I build on Travis CI. The latest build of my master branch looks like this (if you follow the link, it starts at line 655 in the log):

$ make dist RACK_DIR=.build/_deps/racksdk-src
g++  -std=c++11 -Wsuggest-override  -Iplugin -fPIC -I.build/_deps/racksdk-src/include -I.build/_deps/racksdk-src/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_WIN -D_USE_MATH_DEFINES  -c -o build/plugin/Plugin.cpp.o plugin/Plugin.cpp
In file included from plugin/Plugin.cpp:30:
plugin/modules/xycloid/Xycloid.h:50:10: warning: 'virtual void dhe::xycloid::Xycloid::process(const rack::engine::Module::ProcessArgs&)' can be marked override [-Wsuggest-override]
     void process(ProcessArgs const &args) {
          ^~~~~~~
g++ -o plugin.dll build/plugin/Plugin.cpp.o  -shared -L.build/_deps/racksdk-src -lRack 
rm -rf dist
mkdir -p dist/"DHE-Modules"
cp plugin.dll dist/"DHE-Modules"/
strip -s dist/"DHE-Modules"/plugin.dll
cp -r --parents LICENSE.txt presets svg plugin.json dist/"DHE-Modules"/
cd dist && zip -q -9 -r "DHE-Modules"-"1.2.0"-win.zip "DHE-Modules"
The command "make dist RACK_DIR=.build/_deps/racksdk-src" exited with 0.

One difference I can see is that I build with the 1.1.6 Rack SDK, and it looks as if you’re building with the Rack source code. I have no idea why that would matter.

The problem shows up during linking, but it might be caused by something in the compilation. What does your compile command line look like? Your full compiler console output?

Also, are you building DHE-Modules master branch or some other commit?

squinkylabs commented 4 years ago

Here's info. Yes, I always build from Rack source.


bruce@DESKTOP-Q45DVE8 MINGW64 /c/Rack/plugins/DHE-Modules
$ make clean
rm -rf .build
rm -rf .stage
rm -rfv build plugin.dll dist
removed 'build/plugin/Plugin.cpp.d'
removed 'build/plugin/Plugin.cpp.o'
removed directory 'build/plugin'
removed directory 'build'

bruce@DESKTOP-Q45DVE8 MINGW64 /c/Rack/plugins/DHE-Modules
$ make
g++ -std=c++11 -Wsuggest-override  -Iplugin -fPIC -I../../include -I../../dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_WIN -D_USE_MATH_DEFINES  -c -o build/plugin/Plugin.cpp.o plugin/Plugin.cpp
In file included from plugin/Plugin.cpp:30:
plugin/modules/xycloid/Xycloid.h:50:10: warning: 'virtual void dhe::xycloid::Xycloid::process(const rack::engine::Module::ProcessArgs&)' can be marked override [-Wsuggest-override]
   50 |     void process(ProcessArgs const &args) {
      |          ^~~~~~~
g++ -o plugin.dll build/plugin/Plugin.cpp.o -shared -L../.. -lRack
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/plugin/Plugin.cpp.o:Plugin.cpp:(.rdata$.refptr._ZN3dhe7xycloid7Xycloid16wobbleDepthRangeE[.refptr._ZN3dhe7xycloid7Xycloid16wobbleDepthRangeE]+0x0): undefined reference to `dhe::xycloid::Xycloid::wobbleDepthRange'
collect2.exe: error: ld returned 1 exit status
make: *** [../../compile.mk:59: plugin.dll] Error 1

bruce@DESKTOP-Q45DVE8 MINGW64 /c/Rack/plugins/DHE-Modules
$ git status
On branch master
Your branch is up to date with 'origin/master'.
dhemery commented 4 years ago

It looks as if I've been using an old mingw (v8.1.0). When I upgrade to your version (10.2.0) I get the same error.

I'll have to do some research to find the "right" version to use in my Travis CI builds. My preference is to use the same environment that the library builder uses, to minimize the chance of incompatibility.

In any case, I can now reproduce the error, and will try to fix it so that it compiles and links in mingw 10.2.0 and whatever the library builder uses (if I can find that out).

dhemery commented 4 years ago

I fixed it by making the undefined variable local to the only method that uses it.

And I still don't understand the subtle mysteries of C++ linkage.

The fix is in master. Please try it and let me know if you can build now.

SteveRussell33 commented 4 years ago

I too build everything for Windows. Can confirm fix is good.

squinkylabs commented 4 years ago

Seems fine now, thanks!