I am having an issue with dynamically linking with a couple of Boost’s libraries. Specifically, libboost_system and libboost_filesystem for use in a boost::asio based HTTP library. I am attempting to compile AU, VST, and VST3 files. The project compiles completely fine, but I can not load the VST or AU in REAPER. It does not even show up in my plug-in library. I deduced that it might be an issue with the dylibs for the boost library not existing in a place that the executable can find them. So, I tried copying the files into the application package and running these commands to change where the executable looks for them.
install_name_tool -change libboost_filesystem.dylib @rpath/../Frameworks/libboost_filesystem.dylib MyVST install_name_tool -change libboost_system.dylib @rpath/../Frameworks/libboost_system.dylib MyVST
And verifying it using
otool -L MyVST
while I am in the directory of MyVST. Even after doing this it would still not register as a VST. The same thing happened with AU. I also tried to statically link in those two libraries and it registers a large number of syntax errors in the Boost libraries related to standard library methods needing to be statically linked in. I am not sure where to really look to debug this issue any further. Anybody have any clue as to what is going on?
I’m also using boost - what I ended up doing is to not link against the boost libraries but including the relevant boost .cpp files directly into my project (as a juce-module) - but YMMV depending on which boost version you are using.
For that to work, I needed to define BOOST_ALL_NO_LIB=1 and figure out - one by one - where the missing symbols the linker complained about where located.
I know aim for avoiding dynamic libraries wherever possible and to build one monolithic binary that contains everything.
regarding your “syntax errors”: My guess is, that you’re linking one binary against libstdc++ and the other one against libc++ - so what you could do is to switch the c++ library on either. I personally go for libc++ wherever possible.
Which version of Boost did you try that method with? I am using Boost 1.58 with this project. And with that definition is that inside of your code or changing something in a Boost C++ file?
BOOST_ALL_NO_LIB=1 is a preprocessor definition in the Projucer. It’s required to disable auto-linking against the boost libraries on windows. I did not change anything of the boost sourcecode.
I’m currently using 1.59 - but I think this approach will work with 1.58 as well.
I’m only using boost-serialization and boost-system. It’s possible, that using boost-filesystem with that approach is a little bit more involved.
But the basic steps are:
- define BOOST_ALL_NO_LIB=1 via the projucer
- compile and see what symbols are missing
- add the cpp file from the boost source release that defines that symbol
- goto 2
It’s not as bad as this might sound, because most of boost is header only and depending on how much of the functionality you’re actually using just a few of boosts .cpp files are required. (16 in my case, maybe 10 in your case)