https://bugs.kde.org/show_bug.cgi?id=527359

            Bug ID: 527359
           Summary: qtspeech is built without the speech-dispatcher
                    backend, so QTextToSpeech has no usable engine in
                    Flatpak apps
    Classification: Developer tools
           Product: Qt/KDE Flatpak Runtime
      Version First unspecified
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY
The KDE runtime builds qtspeech (added after
https://invent.kde.org/packaging/flatpak-kde-runtime/-/issues/72), but only
with the mock backend. org.kde.Platform//6.11 (Qt 6.11.2) ships only
/usr/lib/plugins/texttospeech/libqtexttospeech_mock.so. As a result
QTextToSpeech::availableEngines() has no usable engine, and text-to-speech
doesn't work in any Flatpak app that relies on the runtime's QtTextToSpeech.

STEPS TO REPRODUCE
1. Build an app that uses QTextToSpeech against org.kde.Sdk//6.11 and give it
the finish-args --filesystem=xdg-run/speech-dispatcher and
--talk-name=org.freedesktop.speech-dispatcher.
2. Run it on a host with a running speech-dispatcher.
3. Or simply list the plugins of the runtime:
   flatpak run --command=ls org.kde.Platform//6.11
/usr/lib/plugins/texttospeech

OBSERVED RESULT
Only libqtexttospeech_mock.so is present. The app has no usable speech engine
and Qt prints at startup:

    No text-to-speech plug-ins were found.

EXPECTED RESULT
The speech-dispatcher backend (libqtexttospeech_speechd.so) is available, so
apps can speak through the speech-dispatcher of the host.

SOFTWARE/OS VERSIONS
Runtime: org.kde.Platform//6.11 and org.kde.Sdk//6.11 (Qt 6.11.2), flatpak
1.16.6, flatpak-builder 1.4.8
Host: Ubuntu 26.04 with speech-dispatcher 0.12.1 (espeak-ng output module)

ADDITIONAL INFORMATION

Cause:
The speech-dispatcher backend of qtspeech is built only when libspeechd is
found at configure time (qt_find_package(SpeechDispatcher ...) in
src/tts/configure.cmake, then "if(QT_FEATURE_speechd AND UNIX)" in
src/plugins/tts/CMakeLists.txt). Neither the freedesktop SDK nor the KDE
runtime provides speech-dispatcher, so the feature is silently turned off. The
qt6.9 and qt6.10 branches of the runtime are affected the same way.

Proposal:
1. Add the speech-dispatcher client library (libspeechd) to the runtime. Only
the client is needed: the speech-dispatcher server, output modules and voices
stay on the host, and the app connects to them through
$XDG_RUNTIME_DIR/speech-dispatcher/speechd.sock. dotconf is needed only to
build speech-dispatcher and doesn't have to ship.
2. Build qtspeech with -DFEATURE_speechd=ON, so that a missing libspeechd fails
the build instead of silently dropping the backend.

Tested modules:
We use these modules in our app manifest as a workaround. They build with
flatpak-builder --sandbox against org.kde.Sdk//6.11:

    {
        "name": "dotconf",
        "buildsystem": "autotools",
        "config-opts": [ "--disable-static" ],
        "cleanup": [ "*" ],
        "sources": [
            { "type": "git", "url": "https://github.com/williamh/dotconf.git";,
"tag": "v1.4.1", "commit": "7c3e0515c29efce45de6aae29befb2ab4396bd60" },
            { "type": "shell", "commands": [ "autoreconf -fi" ] }
        ]
    },
    {
        "name": "speech-dispatcher",
        "buildsystem": "autotools",
        "config-opts": [
            "--disable-static", "--disable-python", "--disable-doc",
            "--without-espeak", "--without-espeak-ng", "--without-flite",
"--without-ibmtts",
            "--without-voxin", "--without-ivona", "--without-pico",
"--without-baratinoo",
            "--without-kali", "--without-libao", "--without-pipewire",
"--without-alsa",
            "--without-oss", "--without-nas", "--with-pulse",
            "--with-systemdsystemunitdir=no", "--with-systemduserunitdir=no"
        ],
        "cleanup": [
            "/bin", "/etc", "/libexec", "/share", "/lib/speech-dispatcher",
            "/lib/speech-dispatcher-modules", "/lib/*.la",
"/lib/libspeechd_module.so*"
        ],
        "sources": [
            { "type": "archive", "url":
"https://github.com/brailcom/speechd/releases/download/0.12.1/speech-dispatcher-0.12.1.tar.gz";,
"sha256": "b14a5238d287d2dcce4dd42bbd66ca65fa228e7e683708267f7b34036f7ba4b4" }
        ]
    }

In the runtime, /include and /lib/pkgconfig of speech-dispatcher would of
course stay in the SDK. Our app manifest removes them, because there qtspeech
is built again only to get the plugin.

Verification:
With these modules and qtspeech 6.11.2 built with -DFEATURE_speechd=ON:
- libqtexttospeech_speechd.so loads inside the sandbox and links against
libQt6TextToSpeech.so.6 from the runtime and against libspeechd.so.2.
- The "No text-to-speech plug-ins were found" message is gone.
- The app connects to the host's speech-dispatcher 0.12.1 (espeak-ng output
module) through the socket in xdg-run/speech-dispatcher.

Why in the runtime rather than in each app:
Building qtspeech again in every app only to get one plugin is fragile, because
the plugin has to match the runtime's Qt version exactly. It also doesn't help
other apps. NeoChat, which reported the missing QtTextToSpeech module in the
issue linked above, has the same limitation.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to