Skip to content

fix(cmake): 修复 sapi-static 单独构建时 mpdecimal 缺少 C++ 标准导致的 macOS 编译失败 - #127

Merged
matyhtf merged 1 commit into
swoole:masterfrom
alwaysLinger:fix/mpdecimal-cxx-standard
Oct 8, 2026
Merged

matyhtf merged 1 commit into
swoole:masterfrom
alwaysLinger:fix/mpdecimal-cxx-standard

Conversation

@alwaysLinger

Copy link
Copy Markdown
Contributor

sapi-static/CMakeLists.txt 在 php-builder 私有运行时流程中被单独作为顶层 CMake 工程使用,因此读不到根 CMakeLists 里的 CMAKE_CXX_STANDARD 17。mpdecimal_obj 目标唯一的 C++ 源文件 decimal.cc 就按编译器默认标准编译——Apple Clang 默认 gnu++98,decimal.hh 的 constexpr 全部编译失败(Linux GCC 11+ 默认 gnu++17,所以 CI 从未暴露)。

为其显式补上 CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON,与其既有的 C_STANDARD 99 并列。修复后 macOS(Apple Clang)构建通过,Linux 语义零变化。

@matyhtf
matyhtf merged commit e5e5bcd into swoole:master Oct 8, 2026
@matyhtf

matyhtf commented Oct 8, 2026

Copy link
Copy Markdown
Member

感谢提交修复,也感谢详细的问题分析和构建验证!PR 已合并。

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.

2 participants