Getting PulseAudio dependency to work in Ubuntu Docker image

I’m trying to get FMOD to work in my Unity game’s CI playmode tests. These tests run in GitHub Actions using Ubuntu 22.04 Docker images maintained by GameCI.

Using the Docker image as is, I get:

[FMOD] FMOD_OS_Library_Load : dlopen failed to open 'libpulse.so.0', dlerror = libpulse.so.0: cannot open shared object file: No such file or directory

After running apt-get install libpulse-dev, I get:

[FMOD] FMOD_PulseAudio_CheckOutputSupport : pa_context_connect returned -1.

I’m not sure how to get past this second error. Does anyone have any ideas for getting PulseAudio to work in a Ubuntu 22 Docker image on GitHub Actions?

GitHub issue on game-ci/docker: Missing `libpulse.so.0` causes test failure when using FMOD · Issue #249 · game-ci/docker · GitHub

I haven’t found a solution to fix PulseAudio support in the Docker image yet.

For anyone else who has this issue, the solution I ended up going with is to prevent FMOD from setting the output type to PulseAudio when running the Unity editor in the test environment.

Fixing the output type proved challening, as the PreInitialize hook runs too late to prevent the error. In the end, I used sed to modify RuntimeManager.cs as part of the GitHub workflow.

      # PulseAudio does not work in Docker container
      - name: Patch FMOD to disable sound
        run: |
          sed -i'' \
          's/result = coreSystem.setOutput(outputType);/result = coreSystem.setOutput(FMOD.OUTPUTTYPE.NOSOUND);/' \
          Assets/Plugins/FMOD/src/RuntimeManager.cs

Hi,

Thank you for the information and providing the workaround.

Would it be possible to view the action on GitHub? What version of the FMOD integration are you using? Another user encountered a similar issue: Docker Windows “DllNotFoundException: fmodstudioL” - #13 by megaleon it may provide useful information.

Hi Connor,

The version of the FMOD integration I’m using is 2.02.23, the latest version from the Unity package manager.

Here’s a minimal GitHub repo I created to demonstrate the first issue (dlopen failed to open 'libpulse.so.0'). There are two workflow runs, one of them with FMOD fully enabled (which fails) and one with the FMOD integration patched to disable sound (which passes).

Repo: GitHub - 12joan/fmod-game-ci-repro: https://github.com/game-ci/docker/issues/249
Workflow run: Initial commit · 12joan/fmod-game-ci-repro@f1dc80c · GitHub
Workflow file: Initial commit · 12joan/fmod-game-ci-repro@f1dc80c · GitHub
Results: playmode-results.xml.log (3.8 KB) playmode.log (2.3 MB)

Also, here’s a workflow run from my game’s GitHub repo where I’ve installed libpulse-dev and got the second error (pa_context_connect returned -1.). In all other respects this run is equivalent to the one above from the minimal repo.

Workflow run: Fix: Pathfinding agents can pass through walls · anderbellstudios/pop-pixie@51cacb4 · GitHub
Results: playmode-results.xml.log (32.1 KB) playmode.log (2.6 MB)

Someone on the GameCI issue suggested that I try installing libpulse0 and libpulse-mainloop-glib0 in addition to libpulse-dev, but I haven’t had time to try this yet unfortunately.

1 Like

Thank you for setting this all up. It was massively helpful. I believe that setting the output to NOSOUND is the best solution. It will allow for FMOD to perform all mixing while discarding the final output. It should still allow you to test the FMOD system successfully. FMOD Engine | Core API reference - FMOD_OUTPUTTYPE_NOSOUND.

Again, thank you for setting this all up and sharing your workaround. A lot of people will find it greatly useful.

No problem! It would be great if the FMOD integration could provide a more idiomatic way to prevent the default output type from being initialized using callbacks, so that we don’t have to modify the integration code using sed.

For example, if the PreSystemCreate hook was exposed as a callback handler and called prior to getting the output type from the current platform, a custom callback could call a method or set a property on the current platform to override its output type. The user code for that would look something like this:

// Hypothetical solution, does not currently work
public class MyFMODCallbackHandler : FMODUnity.PlatformCallbackHandler {
  public override void PreSystemCreate(FMODUnity.Platform platform) {
    platform.OutputTypeName = "NOSOUND";
  }
}

(I added the comment for the benefit of anyone skimming this)

1 Like

Thank you for the suggestion. In theory, it should work. Using your repository, I was able to identify the issue and will pass it on to our development team for further investigation. I’ll post updates here once we have more information.

A solution has been found and will be included in an upcoming release.

This is great news!

What is the nature of the solution, and is there any action that needs to be taken on the part of the GameCI Docker image or the Unity game itself to ensure that FMOD works correctly in CI?

No, it is an internal change. Rather than returning an error on failing to open the library, it will just log it as FMOD can still initialize successfully in NOSOUND mode. So you will not have to make any changes.

That’s a neat solution. Thanks for your help!

1 Like