Repository navigation
fix(build): 修复非 glibc libc 平台缺少 fcloseall 导致的编译失败 - #76
Merged
Merged
Conversation
fcloseall is a glibc extension and is absent on other libcs (bionic, musl, etc.), which breaks the build on those platforms. fflush(NULL) provides the same flushing behavior needed here and is what the existing Apple compatibility shim already maps fcloseall to, so it is a tested behavior on a supported platform. The now-dead shim is removed along with the call-site changes. Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
xiaoxuan-yu
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
fcloseall()是 glibc 的扩展函数,Android bionic、musl 等 libc 中都不存在,导致SPONGE/control.cpp和SPONGE/utils/control/error.hpp在这些平台上编译时报use of undeclared identifier 'fcloseall'。在 Termux(bionic,ARM64)上可直接复现,是构建的阻塞点。方案
两处
fcloseall()统一替换为标准 C 的fflush(NULL):它刷新所有打开的输出流,满足此处需求(错误退出前的输出刷新,以及Clear()的清理)。common.h中原有的 Apple 兼容 shim 本来就把fcloseall映射为fflush(NULL),说明该行为在上游已支持的 macOS 上就是可接受的实现,因此一并移除已无用的 shim。不引入新的平台判断,Android/bionic、musl 等非 glibc 平台均可直接编译。验证
dev-cpu(clang 22.1)全量构建通过(62/62)。fcloseall阻塞构建。