Compile on Devuan or Debian but sound fails

Get help for specific problems
Posts: 306
Joined: 7 Jan 2018

bgstack15

FreeFileSync 10.15 adds the sounds back to the Linux release. I try to build the application myself, but I simply cannot get the sounds to work.
The released binary works, so I've got enough of pulseaudio or jack or alsa or whatever is technically required.
My build of FreeFileSync on Fedora works with audio. I can even tell that it is linked to libsdl2:
[bgstack15@desktop2|/home/bgstack15]$ ldd /usr/bin/FreeFileSync  | grep -i sdl libSDL2-2.0.so.0 => /lib64/libSDL2-2.0.so.0 (0x00007f67c9972000)
My build on Devuan does not link to that. Neither does the pre-built binary, probably because it's statically linked which is typical for upstream binary releases.

I don't really know what I'm doing here. Could this perhaps be related to how Debian builds wxWidgets? Maybe it is not linked to libsdl as I expect?

Does anyone else here compile for Debian, or can anybody point me in a direction?
Posts: 306
Joined: 7 Jan 2018

bgstack15

How about any ideas for how to troubleshoot this? Am I going to need to use gdb? I will have to figure out how to use it (again; I forgot).

This isn't a deal-breaker; I love FreeFileSync and will still keep compiling it and using it, but I'm missing the sound functionality in just one distro for my own build and I know it works so I want to get mine to work.
User avatar
Site Admin
Posts: 7048
Joined: 9 Dec 2007

Zenju

The version of SDL2 you're linking against probably doesn't support the sound targets you need. Same issue here: viewtopic.php?t=6505#p21401
Solution: Compile your own SDL2 with proper sound support :)
Posts: 306
Joined: 7 Jan 2018

bgstack15

I am not linking to SDL2 at all! I have experimented with installing libwxgtk-media3.0-dev and libwxgtk-media3.0-gtk3-dev and adjusting the linkflags.

I adjusted the linkflags to the following:
LINKFLAGS = -s -no-pie `wx-config --libs std, aui, media --debug=no` -lz -pthread
And rebuilt. Unfortunately, it appears that that was insufficient. I even added -lSDL2 and it still does not link to it. Is there some code that is supposed to call SDL2? Maybe the wxWidgets package is insufficient somehow?

Do you think that I need to compile SDL2 myself? The debian package for SDL2 has support for pulse and alsa.

Here are the buildflags:
CXXFLAGS = -std=c++2a -pipe -DWXINTL_NO_GETTEXT_MACRO -DLIBSSH2_OPENSSL -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread
User avatar
Site Admin
Posts: 7048
Joined: 9 Dec 2007

Zenju

Maybe the wxWidgets package is insufficient somehow? bgstack15, 07 Sep 2019, 00:45
This could also be the problem. wxWidgets needs to be compiled with SDL2-support, otherwise: no sound.

Do you think that I need to compile SDL2 myself? The debian package for SDL2 has support for pulse and alsa. bgstack15, 07 Sep 2019, 00:45
Sounds pretty usable.
Posts: 306
Joined: 7 Jan 2018

bgstack15

I have a gdb session output (when the binary was compiled and linked with flag "-g"). Please observe I am linking to system libs for all cases except for what you bundle in the source release zip file. If you could take the time to look at the gdb session output, maybe you can tell me what to do? I don't really know what I'm doing with C and C++. I had to google how to use gdb (which is actually really fascinating).

Thanks for all the help so far! Even if you cannot continue past this point, your attention and guidance have been useful.
Posts: 306
Joined: 7 Jan 2018

bgstack15

I found that one of my Devuan systems actually does play the sounds! I compared installed packages, and adding all the different sound-related-sounding packages did not help. Running FreeFileSync with strace and grepping for openat showed that /dev/dsp does not exist on the system without FreeFileSync sounds. I updated my kernel modules loaded at boot, and rebooted:
$ cat /etc/modprobe.d/oss-compat.conf
softdep snd-pcm post: snd-pcm-oss
softdep snd-mixer post: snd-mixer-oss
softdep snd-seq post: snd-seq-midi snd-seq-oss
That was present on my system where the sound works. I don't know what package placed it, because dpkg-query -S /etc/modprobe.d/oss-compat.conf did not return anything.
So, back to the malfunctioning system, I tried modprobe snd_pcm_oss and the device was created, but it always appeared as "device or resource busy" until the reboot.
Also, /dev/dsp is in use if I am playing any audio with any other application. But, these modules actually allowed my compiled FreeFileSync to play the audio correctly!