C++ sources of intl and pdo_firebird are built without optimization when CXXFLAGS isn't set

未关闭 适合新手
#25,688 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c, cpp, php, shell
领域
build-system

调研方向

这些标志来自 configure.ac,其中 -DNDEBUG 在 AC_PROG_CXX 运行之前被添加到 CXXFLAGS,因此 AC_PROG_CXX 会跳过其默认的 -g -O2。请先阅读 configure.ac 中的这一顺序,并比较 PHP-8.4 和 master 的 Makefile 中生成的 CXXFLAGS_CLEAN。当普通的 ./configure --disable-all --enable-intl 能生成经过优化的 C++ 标志集,且不改变 phpize 或用户提供的 CXXFLAGS 的行为时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Bug Status: Needs Triage
Description

Since 8.5, ./configure without CXXFLAGS builds the C++ sources of ext/intl and pdo_firebird with no -O flag, so they run unoptimized. On 8.4 they get -g -O2.

./configure --disable-all --enable-intl
grep '^CXXFLAGS_CLEAN' Makefile

PHP-8.4 gives CXXFLAGS_CLEAN = -g -O2. PHP-8.5 and master give CXXFLAGS_CLEAN = -DNDEBUG.

It comes from #16511. configure.ac now adds -DNDEBUG to CXXFLAGS before AC_PROG_CXX runs, and AC_PROG_CXX only adds its default -g -O2 when CXXFLAGS isn't set. C files aren't affected, since AC_PROG_CC runs earlier. Builds with phpize and builds that set CXXFLAGS aren't affected either.

I built PHP-8.5 with and without -g -O2 for C++ and measured on a Ryzen 9 5950X with GCC 15. MessageFormatter::format() and IntlBreakIterator take 9–11% fewer cycles with -g -O2.

PHP Version
PHP 8.5.14-dev (PHP-8.5 c97689312d)
Operating System

Ubuntu 26.04

主要语言
C
星标
41.9k
派生
8.5k
平均合并
2 天 18 小时
30 天内合并 PR
106

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

php/php-src 的其他 Issue

查看 php/php-src 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。