Juce on Linux (raspberry) got a seg fault with ALSA


#1

Hi,

I am facing some errors when using juce with Raspberry(3). My Juce Library is built as shared lib.
I compile and link my app againt juce share lib and when I run the application I got a seg fault: here are some details about error message :
Switching to Thread 0x733ec300 (LWP 14884)]
0x7680aecc in juce::(anonymous namespace)::ALSAAudioIODevice::start (this=0x72a15078, callback=0x8) at …/…/…/…/modules/juce_audio_devices/native/juce_linux_ALSA.cpp:945

and by using bt :
(gdb) bt
#0 0x7680aecc in juce::(anonymous namespace)::ALSAAudioIODevice::start (this=0x72a15078, callback=0x8) at …/…/…/…/modules/juce_audio_devices/native/juce_linux_ALSA.cpp:945
#1 0x768019bc in juce::AudioDeviceManager::setAudioDeviceSetup (this=0x72a07218, newSetup=…, treatAsChosenDevice=false)
at …/…/…/…/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:511
#2 0x768002f4 in juce::AudioDeviceManager::initialiseDefault (this=0x72a07218, preferredDefaultDeviceName=…, preferredSetupOptions=0x0)
at …/…/…/…/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:242

Any advice ? thank you
For information ALSA flag is enabled in AppConfig.h


#2

Are you giving a device name in your AudioDeviceSetup? I found that if the device does not exist I get a segfault on an RPi running Ubuntu Mate.


#3

I didnt give any device name , I have the same code that workson MacOS,
juce::String status =deviceManager.initialise(2,2,nullptr,true,{},nullptr);

I tried a basic test with this : and got failed error :

_int_malloc (av=av@entry=0x763e1794 <main_arena>, bytes=bytes@entry=48) at malloc.c:3840
3840 malloc.c: Aucun fichier ou dossier de ce type.

How to setup device because this code works on windows and MacOs ?

After some debug in gdb, errors seems to come from ALSA: scanForDevices()

Any idea ?

Thank you


#4

Hi,

Here is example of my code to list Audio devices :

        unique_ptr<AudioDeviceManager> dManager;
        dManager.reset(new AudioDeviceManager());
       //juce::String status  = dManager->initialise (2, 2, nullptr, true, {}, nullptr);
       //String status = dManager->initialise (2, 2, nullptr, true);
       // cout << "initialise:" << status << endl;
        const OwnedArray<AudioIODeviceType> &types = dManager->getAvailableDeviceTypes();

But this fails with seg fault . when debuging the error is here enumerateAlsaPCMDevices()