[Solved] Linux: Apulse causes segmentation fault

My computer has “apulse” installed, which is a “PulseAudio emulation for ALSA”. (It allows me to use Skype without having to install PulseAudio.) It creates libpulseaudio library files under /usr/lib/, where the emulation occurs. When using lime (2.6.2) to run a linux target, the program terminates without a message. Using gdb, I get the following backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x000000362e28168a in strlen () from /lib64/libc.so.6
(gdb) backtrace 
#0  0x000000362e28168a in strlen () from /lib64/libc.so.6
#1  0x000000362e2813ce in strdup () from /lib64/libc.so.6
#2  0x00007ffff581a0f8 in pulse_open_playback () from ././lime-legacy.ndll
#3  0x00007ffff5807a08 in alcOpenDevice () from ././lime-legacy.ndll
#4  0x00007ffff561dd3f in nme::OpenALInit() [clone .part.20] () from ././lime-legacy.ndll
#5  0x00007ffff561f18f in nme::Sound::Create(std::string const&, bool) () from ././lime-legacy.ndll
#6  0x00007ffff56600cc in nme_sound_from_file(_value*, _value*) () from ././lime-legacy.ndll
#7  0x0000000000649bc5 in ExternalPrimitive::__run(Dynamic const&, Dynamic const&) ()
#8  0x00000000004aed95 in openfl::_legacy::media::Sound_obj::load(hx::ObjectPtr, hx::ObjectPtr, hx::Null) ()
#9  0x00000000004afcda in openfl::_legacy::media::Sound_obj::__construct(hx::ObjectPtr, hx::ObjectPtr, hx::Null) ()
#10 0x00000000004b00f6 in openfl::_legacy::media::Sound_obj::__new(hx::ObjectPtr, hx::ObjectPtr, hx::Null) ()
#11 0x00000000005facbc in DefaultAssetLibrary_obj::getSound(String) ()
#12 0x000000000050cce9 in openfl::_legacy::Assets_obj::getSound(String, hx::Null) ()
#13 0x00000000005a2843 in com::haxepunk::Sfx_obj::__construct(Dynamic, Dynamic) ()
#14 0x00000000005a30d4 in com::haxepunk::Sfx_obj::__new(Dynamic, Dynamic) ()
[...]

I’ve tried various environment variables for SDL (which I assume NME uses?) to use ALSA instead of PulseAudio, but no luck. What works is to move the emulated PulseAudio library files so the program can’t find them, but that’s not really a solution to my problem.

Is there some environment variable or compilation flag I can use to either disable PulseAudio or force it to use ALSA?

Thanks

Do you have issues without using legacy? Could you try a simple OpenFL sample? Thanks!

Right. Great feedback - I’m very new to this stuff so I’m learning while I go along.

Same problem in a bare (non-legacy) project created with ‘lime create project’:

Program received signal SIGSEGV, Segmentation fault.
0x000000362e28168a in strlen () from /lib64/libc.so.6
(gdb) bt
#0  0x000000362e28168a in strlen () from /lib64/libc.so.6
#1  0x000000362e2813ce in strdup () from /lib64/libc.so.6
#2  0x00007ffff55648d8 in pulse_open_playback () from ./lime.ndll
#3  0x00007ffff55521e8 in alcOpenDevice () from ./lime.ndll
#4  0x00007ffff53be36a in lime::lime_alc_open_device(HxString) () from ./lime.ndll
#5  0x000000000050b763 in lime::audio::openal::ALC_obj::openDevice(String) ()
#6  0x0000000000524bd7 in lime::audio::AudioManager_obj::init(hx::ObjectPtr) ()
#7  0x000000000055b4de in lime::_backend::native::NativeApplication_obj::__construct(hx::ObjectPtr) ()
#8  0x000000000055b6f2 in lime::_backend::native::NativeApplication_obj::__new(hx::ObjectPtr) ()
#9  0x0000000000580d44 in lime::app::Application_obj::__construct() ()
#10 0x0000000000579dad in Main_obj::__construct() ()
#11 0x0000000000579f10 in Main_obj::__new() ()
#12 0x0000000000590abb in ApplicationMain_obj::create() ()
#13 0x000000000042311b in ApplicationMain_obj::main() ()
#14 0x0000000000423269 in main ()
(gdb)

Because the segfault is caused by a call to OpenAL, I managed to find a way to configure which drivers it uses, by creating the file “/etc/openal/alsoft.conf” with the contents “drivers = alsa”. Funny thing is that creating a minimal C program which calls alcOpenDevice() works without segfaulting, and even manages to play sound.

Thanks for your help.

We statically link OpenAL-soft, and don’t use a system library. It’s possible your system has OpenAL already, and is configured to work properly. It’s also possible that version 1.16 fixes this problem:

http://kcat.strangesoft.net/openal.html

We could look at updating if it would help :slight_smile: