Skip to content

sound: use openal-soft instead of the frozen system OpenAL on macOS#3072

Open
tomjn wants to merge 1 commit into
beyond-all-reason:masterfrom
tomjn:fix/openal-soft-on-macos
Open

sound: use openal-soft instead of the frozen system OpenAL on macOS#3072
tomjn wants to merge 1 commit into
beyond-all-reason:masterfrom
tomjn:fix/openal-soft-on-macos

Conversation

@tomjn

@tomjn tomjn commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What

On macOS, steer find_package(OpenAL) toward openal-soft instead of the system OpenAL.framework.

Why

macOS' system OpenAL.framework is frozen at a pre-EFX version and does not ship efx.h / alext.h. With find_package(OpenAL) selecting it, the EFX sound code fails to compile (and would not work at runtime even if it did):

fatal error: efx.h: No such file or directory
fatal error: alext.h: No such file or directory

openal-soft implements EFX, but Homebrew installs it keg-only, so it is not on the default search path and find_package keeps picking the framework. On APPLE, this locates the keg via brew --prefix openal-soft, prepends it to CMAKE_PREFIX_PATH, and sets CMAKE_FIND_FRAMEWORK LAST so openal-soft's headers/library are found ahead of the framework. It falls back to the previous behaviour when brew / openal-soft are unavailable.

Requires openal-soft to be installed (brew install openal-soft).

Testing

  • Before: building the sound target on macOS failed on the efx.h / alext.h includes shown above.
  • After (with openal-soft installed): find_package(OpenAL) resolves to /opt/homebrew/opt/openal-soft (verified in the cache), and the OpenAL/EFX include errors are gone. Remaining build errors on plain master are unrelated, pre-existing macOS portability issues (FastMath circular include, MemPool thread-id cast) tracked separately; with those present the sound target builds cleanly on macOS arm64 (Homebrew GCC 16). No change on non-Apple platforms.

AI usage disclosure

Identified and drafted with AI assistance (Claude Code); reviewed and build-verified by a human.

macOS' system OpenAL.framework is frozen at a pre-EFX version and does not
ship efx.h / alext.h, so find_package(OpenAL) selecting it makes the EFX
sound code fail to compile (and it would not work at runtime either):

    fatal error: efx.h: No such file or directory
    fatal error: alext.h: No such file or directory

Prefer openal-soft, which implements EFX. Homebrew installs it keg-only,
so it is not on the default search path and find_package would otherwise
keep picking the framework. On Apple, locate the keg via `brew --prefix
openal-soft`, prepend it to CMAKE_PREFIX_PATH, and set CMAKE_FIND_FRAMEWORK
to LAST so the openal-soft headers/library are found ahead of the system
framework. Falls back to the previous behaviour when brew/openal-soft are
unavailable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant