brailcom / speechd

Common high-level interface to speech synthesis
GNU General Public License v2.0
220 stars 64 forks source link

Module loading does not work with dlopen (--disable-ltdl) #782

Closed voyageur closed 2 years ago

voyageur commented 2 years ago

I found this on Gentoo Linux, where we use the new --disable-ltdl flag on recent 0.11.3 (and 0.11.2) which includes #756.

Trying to load modules with dlopen fails on my system, tested with a sd_generic module (piping in gTTS) and dummy module.

Configure command: ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --disable-static --docdir=/usr/share/doc/speech-dispatcher-0.11.3 --htmldir=/usr/share/doc/speech-dispatcher-0.11.3/html --with-sysroot=/ --libdir=/usr/lib64 --disable-ltdl --disable-python --disable-static --with-baratinoo=no --with-ibmtts=no --with-kali=no --with-pico=no --with-voxin=no --with-alsa --without-libao --without-espeak --without-espeak-ng --without-flite --with-nas --with-pulse --with-systemdsystemunitdir=/lib/systemd/system

First issue is dlopen command does not find the library:

==> /tmp/speechd-debug/dummy.log <==
 Mon Oct 17 11:41:26 2022 [20633]: Additional logging initialized
 Mon Oct 17 11:41:26 2022 [20920]: Opening audio output system
 Mon Oct 17 11:41:26 2022 [20964]: Can't use server: Cannot open plugin server. error: /usr/lib64/speech-dispatcher/spd_server: cannot open shared object file: No such file or directory
 Mon Oct 17 11:41:26 2022 [21191]: Opening audio output system
 Mon Oct 17 11:41:26 2022 [21208]: Can't use pulse: Cannot open plugin pulse. error: /usr/lib64/speech-dispatcher/spd_pulse: cannot open shared object file: No such file or directory

==> /tmp/speechd-debug/gtts-generic.log <==
 Mon Oct 17 11:41:26 2022 [22403]: Additional logging initialized
 Mon Oct 17 11:41:26 2022 [22536]: Opening audio output system
 Mon Oct 17 11:41:26 2022 [22565]: Can't use server: Cannot open plugin server. error: /usr/lib64/speech-dispatcher/spd_server: cannot open shared object file: No such file or directory
 Mon Oct 17 11:41:26 2022 [22861]: Opening audio output system
 Mon Oct 17 11:41:26 2022 [22896]: Can't use pulse: Cannot open plugin pulse. error: /usr/lib64/speech-dispatcher/spd_pulse: cannot open shared object file: No such file or directory

The installed file, as a dynamic library, has .so extension (/usr/lib64/speech-dispatcher/spd_pulse.so), for a quick test I tried adding .so to https://github.com/brailcom/speechd/blob/master/src/common/spd_audio.c#L123 This fixes the dlopen() call, though dlsym() fails just after not finding the symbol:

[Mon Oct 17 12:03:03 2022 : 457280] speechd: Error: Module reported error in request from speechd (code 3xx): 300-Opening sound device failed. Reason: Cannot find symbol spd_audio_plugin_get.
300 MODULE ERROR
.
[Mon Oct 17 12:03:03 2022 : 457294] speechd: ERROR: Can't initialize audio in output module, see reason above.

So probably needs another fix. In the meantime I have reverted back to --enable-ltdl

Downstream bug : https://bugs.gentoo.org/877339

voyageur commented 2 years ago

Fixed with PR #783 (putting the issue number in commit title did not link properly, sorry)