Closed cschol closed 1 year ago
@cschol , hi thanks for verifying, may be i have an old version, but this is my output of the toolchain: (Please NOTE that your windows build is using the linux variant not the windows as it has these entries: lib/linux/libcsound64.a lib/linux/libcsnd6.a)
[...]
x86_64-w64-mingw32-g++ -o plugin.dll build/src/CsoundModule.cpp.o build/src/plugin.cpp.o build/src/textfield.cpp.o build/src/rnd.cpp.o lib/win/libcsound64.a lib/win/libsndfile.a -lws2_32 -shared -L/home/docb/git/rack-plugin-toolchain/Rack-SDK-win -lRack -static-libstdc++
rm -rf dist
mkdir -p dist/dbRackCsound
cp plugin.dll dist/dbRackCsound/
x86_64-w64-mingw32-strip -s dist/dbRackCsound/plugin.dll
cp -r --parents res LICENSE presets plugin.json dist/dbRackCsound/
cd dist && tar -c dbRackCsound | zstd -19 -o "dbRackCsound"-"2.0.0"-win.vcvplugin
/*stdin*\ : 30.86% (4894720 => 1510620 bytes, dbRackCsound-2.0.0-win.vcvplugin)
make[1]: Leaving directory '/home/docb/git/Rack2/plugins/dbRackCsound'
mkdir -p plugin-build
cp /home/docb/git/Rack2/plugins/dbRackCsound/dist/*.vcvplugin plugin-build/
cd /home/docb/git/Rack2/plugins/dbRackCsound && make clean
make[1]: Entering directory '/home/docb/git/Rack2/plugins/dbRackCsound'
rm -rfv build plugin.dll dist
removed 'build/src/plugin.cpp.d'
removed 'build/src/rnd.cpp.o'
[...]
no error
commenting out include ../../arch.mk
will result in that always the linux variant is taken and this makes the build failing.
what should be the solution?
And i really do not understand: One latest module Visualizer from RPJ has exacctly the same:
# If RACK_DIR is not defined when calling the Makefile, default to two directories above
$(info Rackdir is $(RACK_DIR))
RACK_DIR ?= ../..
include $(RACK_DIR)/arch.mk
# FLAGS will be passed to both the C and C++ compiler
RACK_DIR ?= ../..
include $(RACK_DIR)/arch.mk
is not the same as
include ../../arch.mk
The toolchain overrides RACK_DIR
to be different than ../..
.
I am looking into while the build process is failing to select the correct arch.
Using
RACK_DIR ?= ../..
include $(RACK_DIR)/arch.mk
fixes the build issues.
This doesn't quite make sense since it should not be necessary to include arch.mk
specifically. But I will look at that separately.
I will test the cross-compiled build a Windows system and see if the init()
error shows up.
Are you intentionally using the Linux headers for the Windows build?
else ifdef ARCH_WIN
FLAGS += -I lib/linux/csound
LDFLAGS += lib/win/libcsound64.a lib/win/libsndfile.a -lws2_32
else
Yes currently ... because the headers from the windows distribution fail to built - it seems they are not suited for mingw -- i will remove them.
Maybe that is the problem with the missing init()
symbol: a mismatch in library and header files.
The error message displayed is from the plugin.cpp code and stated that the plugin InitCallback is not found which has imho nothing to do with csound. but one never knows. The referenced headers in the linux dir are cross plattform.
This is the error message from your initial report:
Failed to read init() symbol in C:/Users/User/Documents/Rack2/plugins/dbRackCsound/plugin.dll
Where does the InitCallback
message show up?
it seems to be obvious that the error message comes from here https://github.com/VCVRack/Rack/blob/5551617afff182925940908eaf73a7d7361303cc/src/plugin.cpp#L114
and the init symbol should refer to the init function in the plugin.cpp. https://github.com/docb/dbRackCsound/blob/a0138988d0ac4fe11b131918198703c59d0ba04e/src/plugin.cpp#L10
I looked into this.
I used Dependency Walker to check out the plugin.dll
on Windows and it does not contain any Rack related symbols, and definitely not the init
symbol. I cross-compiled another plugin and it had the correct Rack symbols, incl. init
, present in Dependency Walker. It looks like the symbols in the plugin.dll
are only csound
related symbols.
I stripped all csound
references from your plugin and re-compiled. The Rack symbols now show up correctly. As soon as I add one reference to a csound
symbol, for example the line DBCsound cs;
, which cause csound
to get linked in, the Rack symbols disappear from the plugin.dll
.
csound
to get the link issues figured out. You can also use objdump -p plugin.dll
to check on GNU/Linux, which symbols are present in the .dll
if you don't have access to Dependency Walker.ok thank you very much! i will look into this.
RTFM: mingw ld has the logic to require the option --export-all-symbols IF somewhere there is a __declspec(dllexport) attribute otherwise it exports only these.
Nice find! I tested with a toolchain build and subsequent load on Windows and it works fine now.
Moving this discussion to your plugin issue tracker.
First, your plugin does not build with the official
rack-plugin-toolchain
.There is no need to include
arch.mk
. It is already available and include by Rack automatically. This code will break when compiled with the Rack Plugin Toolchain.Second, the Windows cross-compile fails due to a linker error:
This needs to be resolved before troubleshooting any toolchain build issues. Thanks.