Need help on building plugins on Linux / Makefiles!

What’s the best practice here? Although I have had no trouble building the base library with Makefiles, plugins often don’t have Makefiles accompanying them.

ofxFFT, for example, wants me to copy it to the addons $OF_ROOT/AddOns directory, but contains no internal Makefile.

I need to know:

  • How to build this addon and its dependencies
  • How to add the linker and include paths to my Makefile-based build
  • How to add it and its dependencies to my build.

I feel like I’m missing a crucial doc somewhere on Makefile builds! Many thanks!

The coolest part about openFrameworks is that ofxAddons are source file based. It means grep everything and compile, that’s it. You can use projectGenerator that will setup new folder with everything needed in it, I have this text which I copy paste across all of my addons:

Download and extract addon folder to your openFrameworks/addons directory. Go to openFrameworks/apps/projectGenerator/projectGeneratorSimple folder and build it if it's not compiled already. Then go to relative bin folder and run projectGeneratorSimple. Select an addon in the list of non-core addons. When you finish generating project folder, you can find it in openFrameworks/apps/myApps directory, mySketch is default name for it.

Page to a tutorial from the website:

Hey, so I’ve set up config.addons, but this is what ofxFft is giving me when compiling an example:

/home/user/dev/vendors/of_v0.8.4_linux64_release//addons/obj/linux64/Release/ofxFft/src/ofxFftw.o: In function ofxFftw::setup(int, fftWindowType)': ofxFftw.cpp:(.text+0x19): undefined reference tofftwf_malloc’
ofxFftw.cpp:(.text+0x25): undefined reference to fftwf_malloc' ofxFftw.cpp:(.text+0x3f): undefined reference tofftwf_plan_r2r_1d’
ofxFftw.cpp:(.text+0x4e): undefined reference to fftwf_malloc' ofxFftw.cpp:(.text+0x5a): undefined reference tofftwf_malloc’
ofxFftw.cpp:(.text+0x7a): undefined reference to fftwf_plan_r2r_1d' /home/mlabbe/dev/vendors/of_v0.8.4_linux64_release//addons/obj/linux64/Release/ofxFft/src/ofxFftw.o: In functionofxFftw::executeFft()’:
ofxFftw.cpp:(.text+0x237): undefined reference to fftwf_execute' /home/mlabbe/dev/vendors/of_v0.8.4_linux64_release//addons/obj/linux64/Release/ofxFft/src/ofxFftw.o: In functionofxFftw::executeIfft()’:
ofxFftw.cpp:(.text+0x4ee): undefined reference to fftwf_execute' /home/mlabbe/dev/vendors/of_v0.8.4_linux64_release//addons/obj/linux64/Release/ofxFft/src/ofxFftw.o: In functionofxFftw::~ofxFftw()’:
ofxFftw.cpp:(.text+0x6cd): undefined reference to fftwf_destroy_plan' ofxFftw.cpp:(.text+0x6d6): undefined reference tofftwf_free’
ofxFftw.cpp:(.text+0x6df): undefined reference to fftwf_free' ofxFftw.cpp:(.text+0x6eb): undefined reference tofftwf_destroy_plan’
ofxFftw.cpp:(.text+0x6f4): undefined reference to fftwf_free' ofxFftw.cpp:(.text+0x700): undefined reference tofftwf_free’
ofxFftw.cpp:(.text+0x705): undefined reference to fftwf_cleanup' /home/mlabbe/dev/vendors/of_v0.8.4_linux64_release//addons/obj/linux64/Release/ofxFft/src/ofxFftw.o: In functionofxFftw::~ofxFftw()’:
ofxFftw.cpp:(.text+0x74d): undefined reference to fftwf_destroy_plan' ofxFftw.cpp:(.text+0x756): undefined reference tofftwf_free’
ofxFftw.cpp:(.text+0x75f): undefined reference to fftwf_free' ofxFftw.cpp:(.text+0x76b): undefined reference tofftwf_destroy_plan’
ofxFftw.cpp:(.text+0x774): undefined reference to fftwf_free' ofxFftw.cpp:(.text+0x780): undefined reference tofftwf_free’
ofxFftw.cpp:(.text+0x785): undefined reference to fftwf_cleanup' collect2: error: ld returned 1 exit status make[1]: *** [bin/test_fft] Error 1 make[1]: Leaving directory/home/mlabbe/dev/fft_test/test_fft’
make: *** [Release] Error 2

Of course I figured it out a minute after posting.

Assuming libfftw3-dev is installed:

USER_LDFLAGS="-lfftw3f" make

Can also be added to the Makefile:
USER_LDFLAGS += “-lfftw3f”