Gargoyle built with -DSOUND=QT makes no sound?

With some valuable help from the author, I’ve managed to build a local copy of Gargoyle from source, using the -DSOUND=QT option to select the Qt sound system.

The resulting executable runs, but it does not produce any sound! Building for SDL results in an executable with correct sound. I don’t know how to begin diagnosing this issue.

The cmake output does not show any problems:

cmake output
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Freetype: /usr/lib/x86_64-linux-gnu/ (found version "2.10.1") 
-- Found JPEG: /usr/lib/x86_64-linux-gnu/ (found version "80") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/ (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/ (found suitable version "1.6.37", minimum required is "1.6") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for modules 'sndfile;libmpg123;libopenmpt'
--   Found sndfile, version 1.0.28
--   Found libmpg123, version 1.25.13
--   Found libopenmpt, version 0.4.11+release.autotools
-- Checking for module 'speech-dispatcher'
--   No package 'speech-dispatcher' found
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.13.1
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- The following OPTIONAL packages have been found:

 * Qt5DBus

-- The following REQUIRED packages have been found:

 * Freetype
 * PNG (required version >= 1.6)
 * Qt5Core (required version >= 5.12.8)
 * Qt5Gui (required version >= 5.12.8)
 * Qt5Widgets
 * Qt5Network (required version >= 5.12.8)
 * Qt5Multimedia
 * Qt5
 * PkgConfig

-- Configuring done
-- Generating done
-- Build files have been written to: <snipped correct path>

and the build completes without error. Can anyone suggest any methods for exploring the cause?

1 Like

Would you mind creating an issue at Issues · garglk/garglk · GitHub? I can track it more easily there.

That being said, it seems likely your QtMultimedia installation is not properly installed/configured (which would be the fault of your distributor). Two things to try immediately:

  1. Pass -DWITH_QT6=ON to use Qt6, if your distribution/OS supports Qt6
  2. Try building a simple Qt sound program at GitHub - cspiegel/qt-sound

If Qt6 works, then you’re OK, and can just chalk it up to your distribution being misconfigured. If it doesn’t, try #2. This is a small program I wrote that should just output a sine tone. Build it with cmake as you do Gargoyle. With no arguments, it uses Qt5. Or you can pass -DWITH_QT6=ON to use Qt6. If you get sounds here where you didn’t in Gargoyle, then it’s a Gargoyle problem. If you don’t, it’s a Qt problem. At least that gives us a starting point.

I did think of something to try: I built a VM with a fresh install of Ubuntu 20.04 and then followed my installation instructions. (Perhaps I’ve made an error there?)

The result was the same. The SOUND=QT version produced no sound, while the SOUND=SDL default version produced sound. It doesn’t look like an issue particular to my environment.

Thank you for the guidance on steps to try. I’m happy to do them, but I don’t have a github account to use to log an issue there. I will report back here in the hopes that it is of use to you or others.

EDIT: OK, here are the results of testing with qt-sound:

  • On both my normal environment and the fresh Ubuntu 20.04 VM:
    • building for QT5, program produces output: “Default audio format not supported - exiting” and finishes.
    • building for QT6, cmake did not complete, and repository (for Ubuntu focal 20.04) has no packages that look appropriate

I didn’t try re-building Gargoyle with QT6 because it doesn’t seem like QT6 is available from the repository.

I took a brief peek at the source code for the qt-sound test, and it looks like the output I saw is part of what you wrote. Maybe it’s a matter of a certain codec being missing?

Ok, I’m not sure about this, but try installing libqt5multimedia5-plugins.

The error message you got indicates your Qt doesn’t support audio, and it’s probably because it’s missing required plugins. Odds are Gargoyle isn’t playing sound for the same reason the test program isn’t.

That did it! The qt-sound program produces a tone, and the rebuilt Gargoyle with -DSOUND=QT seems to be working, too.

I will update my instructions on the other thread. Thank you so much for helping to diagnose the issue!