When using INCLUDEPATH xxx in the .pro file of a node set to include an external header based library (Asio C++ Library) I get “File not found” both with relative and absolute paths after running Qmake. Typing #include "… results in auto-complete only listing the folders/files in the source directory. I guess this is a compiler issue after some testing and reading, but I’m not sure where to go from here. Is it possible for someone from team Vuo to shed some light on using external libraries and gotcha’s that might occur?
See the attached example. I used the ‘stateless’ example in the Vuo SDK (/Library/Developer/Vuo/example/node/stateless) as a starting point.
To build and install the node class:
To answer your original question of how to include an external header-based library — that much was possible by:
placing asio.hpp and the asio folder in the same folder as the node class,
adding #include "asio.hpp" to the node class (jstrecker.asio.test.c), and
adding -I .. to the vuo-compile command in CMakeLists.txt.
However, it took a few more steps to get the node class to actually compile. Because the Asio library uses C++ exceptions, there’s a flag you have to pass to clang (-fexceptions) or else you get compile errors. But there’s currently no way to pass that flag through to clang when you run vuo-compile. So I moved the code that references Asio from jstrecker.asio.test.c to AsioWrapper.cc, and added stuff to CMakeLists.txt to compile AsioWrapper.cc with clang.
Side note: I recently “upgraded” to macos 10.15, and so also xcode 12.1. Because of this, the default MacOs SDK is 10.15. This won’t compile with that, but earlier SDKs can be found here: https://github.com/phracker/MacOSX-SDKs/releases. Download the required one (10.10) and place it in the folder specified in the CMakeLists.txt and it will compile.
After trying out a few things, I now manage to compile a node successfully. However I still have an issue when I try to run a composition with the external library. I guess my understanding of how it works still isn’t quite there. The error message I get inside Vuo is:
Node broken or outdated —
Undefined symbols for architecture x86_64:
"__Z12VuoData_makexPh", referenced from:
_receiveUDPMessage in composite-Ys4j2y-nIfWvb.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
From searching for the issue, it seems like there is something wrong with the build settings, but I don’t understand where that lies.
Attaching the source and nodes if you find the time to look at it.