Segfault when writing audio to file on Linux

Hi, as in the title I am getting a segfault when writing audio to file on Linux.

I am using a modified version of the InputAnalyzer Cinder audio sample. It uses audio::BufferRecorderNode to record from microphone input, and then save it to file.

Here is the code: gist
note: the path is changed on line 97 dependent on platform.

It appears to work fine on macOS and Windows 10, but not on Ubuntu 15.10 or 16.04.

Here is the gdb output: gist comment

Any help would be appreciated!

Hi again, hoping everyone had a good holiday season and new years.
Just bumping this thread, still stuck on this issue. If any Linux gurus could give the code a quick look over, I’d be greatly appreciative, maybe it’s a quick spot. In the meantime I’ll have a go at reproducing the error in the simplest case and update soon.

== update ==
I forgot that the code I linked is the simple case. It’s possible to run it just by downloading it and replacing samples/_audio/InputAnalyzer.cpp with the linked file.
The next step I can think of is to link cinder src to get debug symbols and try and investigate further.

Paging @petros @rich.e

I think I have figured out a work around. It appears that here:

…that there is no linux specific implementation for non ogg file formats. I am not 100% certain of the C++ behaviour in this situation, as it would seem there is no return statement so I am surprised this compiles. I would hypothesize that nullptr gets returned causing the segfault in the calling function.

My work around is to use “.ogg” instead of “.wav”, which appears to work.


as you already figured out .wav targets seems to be missing. Rich would have more to say about the details off this I m sure.

As for the C++ behavior, well, its basically undefined the way it is currently.

It does compile since its not a C++ standard requirement that the function should indeed return ( i.e the function could throw an exception so not returning a value in this case would be no problem ) but if you reach the end of the function then things go south.

That said the compiler ( g++ at least ) should warn about this if -wall or -wreturn-type is enabled.

In any case this should be fixed and return a nullptr ( maybe with a warning log ? ) until an implementation for other targets than .ogg is there. Maybe an issue on Github would be the appropriate place to start with so that this doesn’t get missed.


Thanks Petros! I have made an issue here