ofxFft on Linux, an attempt. And the final act.

I am really stubborn and don’t want to quit Linux in order to use OpenFrameworks more quickly, so I’m having a bit of trouble on the way…

After some initial issues here, I’m trying to compile and build Kyle’s ofxFft, here are the steps I went trough:

  • Copied the ofxFft directory to /examples/empty

  • Deleted all the examples directories except /example-basic

  • Copied from /examples/ofxFft/src the following files:

  • ofxFftBasic.cpp

  • ofxFftBasic.h

  • ofxFft.cpp

  • ofxFft.h
    to the /example-basic/src directory

    • Copied config.make and Makefile from empty example to /examples/ofxFft/

    • On terminal did sudo make

Did NOT copied addons.make because I had lots of these:

  
obj/x86_64Release/example-basic/src/kiss_fft.o: In function `kiss_fft_alloc':  
kiss_fft.c:(.text+0x857): multiple definition of `kiss_fft_alloc'  
obj/x86_64Release/libs/kiss/kiss_fft.o:kiss_fft.c:(.text+0x857): first defined here  
obj/x86_64Release/example-basic/src/kiss_fft.o: In function `kiss_fft_stride':  
kiss_fft.c:(.text+0x97b): multiple definition of `kiss_fft_stride'  
obj/x86_64Release/libs/kiss/kiss_fft.o:kiss_fft.c:(.text+0x97b): first defined here   

It compiled and linked:

  
     compiling done  
     to launch the application  
  
     cd bin  
     ./ofxFft-02  

That was a major improvement from not being able to do anything at all.

Now I go to /bin and execute ./ofxFft-02 and get this:

ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
[fatal error] You need to add #define ALLOW_FFTW
Segmentation fault (core dumped)

So there are a couple of issues here:

  • First there seems to be something wrong with the audio drivers,

  • Second, though I did delete #define ALLOW_FFTW from the headers and as many references to FFTW that I could, it still looks for them, or at least complains.

  • Third, (and this is highly speculative from my lack of experience) I believe Kyle edited the FFTW and KISS_FFT headers and source so it can’t be tested with the original ones, and there is no source of the FFTW so it can be compiled in linux, Kyle only delivers the compiled FFTW in OsX and Windows.

  • Fourth, I guess there would be other cleverer ways to do what I did but my lack of knowledge limits my options.

Do these errors ring any bells? Please feel free to share your thoughts, specially suggestions on how not to be so clumsy.

Thank you,
cromefx

EDIT: and when I try to compile with the fftw it gives me lots of these:

ofxFftw.cpp:(.text+0x1a): undefined reference to fftwf\_destroy\_plan' ofxFftw.cpp:(.text+0x23): undefined reference tofftwf_free’
ofxFftw.cpp:(.text+0x2c): undefined reference to fftwf\_free' ofxFftw.cpp:(.text+0x38): undefined reference tofftwf_destroy_plan’
ofxFftw.cpp:(.text+0x41): undefined reference to fftwf\_free' ofxFftw.cpp:(.text+0x4d): undefined reference tofftwf_free’
ofxFftw.cpp:(.text+0x52): undefined reference to `fftwf_cleanup’

Everything seems to be ok with the drivers.

I am really stubborn and don’t want to quit Linux in order to use OpenFrameworks more quickly, so I’m having a bit of trouble on the way…

Well… I give up… I’ve been struggling with linux + openFrameworks for a week now and I went back to Windows(7), and had everything working in a couple of hours.

ofxFft is working fine now (thanks to this forum and specially alexlangberg with this-post ).

Not knowing where the problem comes from is very frustrating and true to be said, unfortunately there are not many folks out there working with openFrameworks on linux, (I guess most of them are Mac users), so the community is smaller and there are not many bilderbuchis to help.

I have been using Xubuntu for a couple of years, I do everything there, learn a LOT in there. But for this one, as difficult as it is to say, in this case Windows has to be my option.

One thing though, I do have higher framerates on 3d and GL apps under linux.

I wont give up on linux + openFrameworks, but for now I will prioritize using oF.

Thank you all,
cromefx

well, the problem isn’t OF and linux, it’s old/non-up-to date addons and OF (on linux). you’d have similar problems if an addon only shipped XCode project files. the makefile-based build process on linux is about the least complicated way to get things to run, normally.

but I agree, use what works best for you. :slight_smile:

Hi cromefx,

Personally I find Linux much easier to configure than Windows when working with OF.

Here are the steps to get ofxFft working (for me on Ubuntu 12.10, 64-bit):

Before you do anything, install the FFTW library:

  
sudo apt-get install libfftw3-dev  

The do the following:

  1. Run the Project Generator to create a new project (or alternatively copy the empty example)

  2. Download the ofxFft addon and unzip it into the addons directory. Rename it to ofxFft. You don’t need to touch this directory again

  3. In your new empty example, open up addons.make and add the line “ofxFft”

  4. Then open up config.make and add this “USER_LDFLAGS = -lfftw3f”

  5. Copy the contents of the src folder in the basic ofxFft example and overwrite the empty equivalents in your new project

  6. You should be able to compile the projects now

Just a final note - I had trouble running the debug version of the basic example. Running it in Release worked though. Didn’t bother to follow this up.

Hi all,

I just got the ofxFft examples running on Linux by following Pierre’s steps. Only thing is I had to install libfftw3-dev and not fftw-dev.

Hi there!
Thank you both for the information.

libfftw3-dev is in fact correct, that was a typo. I’ve updated my original post.
Thanks!