Cannot compile a local addon

So in order to help make my oF code a bit more portable, I’ve been digging into so-called “local addons” (mentioned, for example, at How do you use git for versioning an oF project?) which although not really documented much are incredibly useful. (For me at least, it means I can have a repo for the main project, with any third-party and/or forked addons included as git submodules in a child directory.)

After getting stuck in the beginning, @arturo was kind enough to give some guidance on how to use this mechanism in https://github.com/openframeworks/openFrameworks/issues/5932

The working approach seems to be:

  1. Create a subdirectory called addons (the name doesn’t really matter, but I’ll use it for clarity throughout the example)
  2. Edit the project’s addons.make to use a relative path instead of just a name for the local addon, e.g. addons/ofxGstVideoSyncPlayer instead of ofxGstVideoSyncPlayer
  3. Also edit the project’s config.make to exclude the addons directory (otherwise it gets compiled twice and other such nonsense): PROJECT_EXCLUSIONS = $(PROJECT_ROOT)/addons% works for me
  4. Use make as before

I have tested the above approach by moving a few standard/built-in addons to a local addons (e.g. ofxOsc). I also tried a few third-party addons to be sure. No problem.

However, I have been using https://github.com/RandomStudio/ofxURG (which was forked from https://github.com/underdoeg/ofxURG) and when I apply the same methodology as above I always get make errors like:

make[1]: *** No rule to make target '/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/libs/urg/src/urg_ticks.o', needed by 'bin/lidar-blob-tracker'.  Stop.

What could be going wrong? I suspect that the paths aren’t being resolved properly somewhere along the line, but it is important to note that this same addon compiles perfectly if located in the “root” addons folder. It’s only when moved that it gives the above error.

I’ll include the complete output at that stage of the build, for clarity:

Compiling /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/src/ofxURG.cpp
g++ -c -O3 -DNDEBUG -march=native -mtune=native -Wall -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123  -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/random/of_v0.9.8_linux64_release/libs/fmodex/include -I/home/random/of_v0.9.8_linux64_release/libs/glfw/include -I/home/random/of_v0.9.8_linux64_release/libs/glfw/include/GLFW -I/home/random/of_v0.9.8_linux64_release/libs/kiss/include -I/home/random/of_v0.9.8_linux64_release/libs/poco/include -I/home/random/of_v0.9.8_linux64_release/libs/tess2/include -I/home/random/of_v0.9.8_linux64_release/libs/utf8cpp/include -I/home/random/of_v0.9.8_linux64_release/libs/utf8cpp/include/utf8 -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/utils -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/events -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/math -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/app -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/sound -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/gl -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/video -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/types -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/3d -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/graphics -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/communication -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/src -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg/include -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg/src -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg/include -I/home/random/of_v0.9.8_linux64_release/addons/ofxGui/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/ip -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/ip/posix -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/ip/win32 -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/osc -I/home/random/of_v0.9.8_linux64_release/addons/ofxXmlSettings/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxXmlSettings/libs -I/home/random/of_v0.9.8_linux64_release/addons/ofxArgs/src -MMD -MP -MF /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/src/ofxURG.d -MT /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/src/ofxURG.o -o /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/src/ofxURG.o -c /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/src/ofxURG.cpp

Any help much appreciated!

can you check if the nightly builds have the same problem?

Will give it a try for sure.

Ah hah.

Yes, when trying the same within the latest from master branch of openFrameworks, it all compiles perfectly. (Which I presume corresponds to “nightly”?)

Should I really be porting to the nightly version just to fix this compiling issue? Or is there an easy fix/modification I can make in the build system (or build configuration for this addon?) that would resolve this with oF 0.9.8?

i don’t really remember how i fixed this. you could diff the makefile files for 0.9.8 and latest master and see what are the differences or even just bring the new makefiles to 0.9.8 which i think should work right away

Wow, yes, the diff for the makefiles between master and stable is quite significant. As you say, it might be easiest to either use the latest openFrameworks or just copy these Makefiles across.

I really appreciate your time!