Fix build failures on Windows and Linux #2545
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2545
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2545/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ekt0re on GitHub · 2026-11-24 17:50 UTC · original
Ekt0re:Fix-OpenAL-builds→main· +56 −2 · 2 files · 6 commits · merged 2026-11-25 01:26 UTCFix CI build failures on Windows (
clang-cl) and Linux (clang++)Summary
This PR fixes four independent build failures in the CI, all related to the bundled
openal-softsources or to the toolchain used to build them. No file under3rdparty/is modified: source-level workarounds are applied at configure time on copies placed in the build directory.reverb.cpp(NONBLOCKINGattribute vs MSVC STL)CMakeLists.txtalc.cpp(1784)(std::views::transformdeduction)CMakeLists.txtchorus.cpp,distortion.cpp,pshifter.cpp,fshifter.cpp(mUpsampler.emplace())CMakeLists.txtCMAKE_C_COMPILER_AR-NOTFOUND(LTO tools missing).github/workflows/build.ymlWindows (
clang-cl+ MSVC STL)1.
reverb.cpp:NONBLOCKINGattribute breaksstd::ranges::for_eachCause.
openal-softdefinesNONBLOCKINGas[[clang::nonblocking]]in3rdparty/openal-soft/common/opthelpers.h. With Clang, this attribute becomes part of the type of pointers to member functions, e.g.:The MSVC STL (
std::_Is_memfunptr) does not recognize this type, sostd::ranges::for_eachfails to compile.Fix (
CMakeLists.txt). Right after3rdpartyis added, for theOpenALtarget built with Clang:openal_nonblocking_fix.his generated in the build directory. It includesopthelpers.hand then redefinesNONBLOCKINGas empty./FIforclang-cl,-includefor other Clang frontends.This is consistent with
HAVE_WFUNCTION_EFFECTS OFF, already set in3rdparty. The fix does not depend on the Clang version and does not affect other compilers.2.
alc.cpp(1784):std::views::transformfails with MSVC STL 14.52+Cause. With MSVC STL 14.52+ (Visual Studio Enterprise on the CI runner), deduction of
_Fnfails for&std::unique_ptr<...>::operator*when passed tostd::views::transform. The failing expression is:Fix (
CMakeLists.txt,KYTY_CLANG_CLonly).3rdparty/openal-soft/alc/alc.cppis copied into the build directory asopenal_alc_patched.cpp.alc.cppis markedHEADER_FILE_ONLYfor theOpenALtarget, so only the patched copy is compiled.Linux (
clang+++ libstdc++ 14)3.
mUpsampler.emplace()fails in the effect sourcesCause. Clang <= 19 with libstdc++ 14 evaluates
std::is_constructible_v<std::array<UpsampleParams, NumLines>>asfalsewhenUpsampleParamsis a nested struct with default member initializers (NSDMI) held insidestd::optional. As a result,mUpsampler.emplace()fails to compile in:alc/effects/chorus.cppalc/effects/distortion.cppalc/effects/pshifter.cppalc/effects/fshifter.cppThis is a compiler bug, so it cannot be fixed with a CMake option; it is worked around in the sources instead.
Fix (
CMakeLists.txt). The patching logic was extracted into a reusable function,kyty_patch_openal_source. ForLINUXbuilds withCLANG:mUpsampler.emplace()is replaced with:This constructs the object by move from a value-initialized aggregate, which avoids the zero-argument
is_constructible_vcheck that Clang gets wrong.HEADER_FILE_ONLYfor theOpenALtarget, so only the patched copies are compiled.4.
CMAKE_C_COMPILER_AR-NOTFOUND: missing LLVM archiver toolsCause. With
CMAKE_INTERPROCEDURAL_OPTIMIZATION=ONandclang-19, CMake requiresllvm-ar-19andllvm-ranlib-19. These are not installed byapt-get install --no-install-recommends clang-19.Fix (
.github/workflows/build.yml).llvm-19was added to the build dependencies of thelinuxjob.Files changed
CMakeLists.txtopenal_nonblocking_fix.hfor theOpenALtarget on Clang (C++ only); patched copy ofalc.cppforKYTY_CLANG_CL; new functionkyty_patch_openal_source; patched copies ofchorus.cpp,distortion.cpp,pshifter.cpp,fshifter.cppon Linux + Clang. Originals are markedHEADER_FILE_ONLY.github/workflows/build.ymllinuxjob installsllvm-19Notes
llvm-ar/llvm-ranlib(packagellvm-19).alc.cppand effect-source patches are text replacements on submodule files. After a submodule update, verify that the replaced expressions still exist; otherwise a patch becomes a silent no-op.3rdparty), or switching the Linux job to GCC 14 (not affected by the bug).Testing
clang-cl) build completes,reverb.cppcompilesclang++-19) build completes,chorus.cppanddistortion.cppcompileAI Use
Gemini 4 Hydrogen was used to investigate the root cause of the problem and to write this documentation. Testing and code review were done by me personally.
@coderabbitai[bot] on GitHub · 2026-11-24 17:55 UTC · original · edited 2026-11-25 01:09 UTC
No actionable comments were generated in the recent review.
Walkthrough
The Linux build workflow now adds the LLVM 23 apt repository and installs
clang-23,lld-23, andllvm-23. It adds LLVM 23’s binary directory toGITHUB_PATH. CMake adds Clang-specific OpenAL compatibility patches, including a generated header and conditional source changes forclang-cland Linux builds.Suggested reviewers:
nmzikChange: Bug fix
Merge Risk:
Low · up to
0545aTwo minor build-configuration gaps remain in the OpenAL Clang patch. A build directory containing spaces can break the forced-include on non-clang-cl Clang, and edits to the original alc.cpp may not refresh the patched copy on incremental builds. Neither affects normal CI builds, and both are quick to fix.
Pre-merge checks:
4
Full details: Title check
Explanation
The title "Fix build failures on Windows and Linux" matches the main change: the PR fixes four CI build failures (clang-cl on Windows and clang++ on Linux) through CMake and workflow changes. It is somewhat broad and does not name the OpenAL-specific workarounds, but it refers to the real change and does not describe anything absent from the changeset. The PR objectives also use this title, though the commit message mentions an LLVM 23 toolchain change that the title does not cover.
Full details: Description check
Explanation
The description is closely related to the changeset. It lists the four build failures, the CMakeLists.txt workarounds for OpenAL sources (NONBLOCKING header, alc.cpp lambda, effect-source upsampler patches), the build.yml change that installs LLVM tooling, and the testing performed. It is detailed and on-topic.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
ef7d40bf-adb6-4c67-b48d-f631cdd24823Reviewing files that changed from the base of the PR and between
9cbbd97a3eand0545adc8c9..github/workflows/build.ymlCMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@coderabbitai[bot] on GitHub · 2026-11-24 17:55 UTC · original · edited 2026-11-24 18:51 UTC
On
.github/workflows/build.ymlline 375 (outdated):Link Linux builds with an LLVM 19 linker when Clang 19 uses LTO.
The Linux job enables interprocedural optimization and compiles with
clang-19. Thekyty_emulatorlink then uses-fuse-ld=lld, which resolves to theld.lldfrom the unversionedlldpackage. On Ubuntu 24.04, that package is LLVM 18. LLD 18 reading LTO bitcode from Clang 19 is an older-linker, newer-producer pairing, and LLVM does not support it. The link can fail, or it can produce miscompiled output.Use an LLVM 19 linker for this link, and keep the linker major version equal to the Clang major version. The Ubuntu noble listing shows no
lld-19version, so set the package source for the LLVM 19 linker explicitly. TheVerify toolchainstep prints the linker version throughld.lld --version.zizmor (1.32.0)
[warning] 1-543: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
[warning] 303-445: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
✅ Addressed in commit
9cbbd97@ -193,0 +224,4 @@)else()target_compile_options(OpenAL PRIVATE"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-include ${_kyty_openal_fix_header}>"@coderabbitai[bot] on GitHub · 2026-11-24 17:55 UTC · original
Quote the header path inside the
SHELL:option.CMake parses
SHELL:options withUNIX_COMMANDrules. The generated binary directory path is expanded before that parsing. A build directory that contains a space splits the-includepath into two arguments. The compiler then cannot open the forced-include header, and OpenAL can fail to compile on non-clang-clClang. Paths without spaces are unaffected.Quote the path inside the option string so it stays one argument:
Proposed fix
Committable suggestion
@coderabbitai[bot] on GitHub · 2026-11-24 17:55 UTC · original · reviewed
Actionable comments posted: 2
43a6734c-9cca-40ab-be28-58c3c43cf93fReviewing files that changed from the base of the PR and between
30781dcda0andd7edb04eb6..github/workflows/build.ymlCMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@coderabbitai[bot] on GitHub · 2026-11-24 18:27 UTC · original · reviewed
Actionable comments posted: 1
d6749b17-5c82-4bc8-9447-152e2bd553feReviewing files that changed from the base of the PR and between
d7edb04eb6andeb62622d26..github/workflows/build.ymlCMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
@coderabbitai[bot] on GitHub · 2026-11-24 18:27 UTC · original
On
CMakeLists.txtline 205 (outdated):Track changes to the original
alc.cpp.After configuration, an edit to
alc/alc.cppdoes not refresh the patched copy. The original is now header-only, andfile(READ)does not register a configuration dependency. An incremental build can therefore keep compiling the previous contents. (raw.githubusercontent.com)Append
_kyty_openal_alc_origto the directory’sCMAKE_CONFIGURE_DEPENDSproperty before reading it. This makes source edits rerun the replacement while preservingcopy_if_differentfor unchanged contents. (cmake.org)@coderabbitai[bot] on GitHub · 2026-11-24 18:54 UTC · original · edited 2026-11-25 01:04 UTC
On
CMakeLists.txtline 137 (outdated):Preserve the discovered linker path.
If
ld.lld-19exists only in a directory supplied throughCMAKE_PROGRAM_PATH,find_programsucceeds. This line then discards that directory. CMake explicitly searchesCMAKE_PROGRAM_PATH. (cmake.org)Clang 19 searches its own program paths and
PATHfor-fuse-ld=lld-19. In this configuration, linking fails even when the previous unversioned linker works. (raw.githubusercontent.com)Pass the quoted
KYTY_LLD_VERSIONEDpath through--ld-path, with-fuse-ld=lldto retain the linker flavor. This also works when the executable is onPATH. (raw.githubusercontent.com)✅ Addressed in commit
0545adc@coderabbitai[bot] on GitHub · 2026-11-24 18:54 UTC · original · reviewed
Actionable comments posted: 1
1f86f76a-e15c-4f58-a7d3-384cc706d077Reviewing files that changed from the base of the PR and between
2474ac1110and9cbbd97a3e..github/workflows/build.ymlCMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.