Issue with undefined _GNU_SOURCE
オープン
まだ誰も着手していません。
Bug
Category: Build System
Status: Needs Triage
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
Original report: https://bugzilla.redhat.com/2271925
$ gcc -c -g -O2 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib conftest.c >&5
In file included from /usr/include/php/Zend/zend.h:418,
from /usr/include/php/main/php.h:32,
from conftest.c:63:
/usr/include/php/Zend/zend_operators.h: In function 'zend_memrchr':
/usr/include/php/Zend/zend_operators.h:207:29: error: implicit declaration of function 'memrchr'; did you mean 'memchr'? [-Wimplicit-function-declaration]
207 | return (const void*)memrchr(s, c, n);
| ^~~~~~~
| memchr
/usr/include/php/Zend/zend_operators.h:207:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
207 | return (const void*)memrchr(s, c, n);
| ^
configure:3238: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "test"
| #define PACKAGE_TARNAME "test"
| #define PACKAGE_VERSION "1.0.0-1"
| #define PACKAGE_STRING "test 1.0.0-1"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define STDC_HEADERS 1
| /* end confdefs.h. */
| #include <stddef.h>
| #ifdef HAVE_STDIO_H
| # include <stdio.h>
| #endif
| #ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| #endif
| #ifdef HAVE_STRING_H
| # include <string.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <php.h>
configure:3238: result: no
configure:3243: PHP haders not found or test compile failed
Notice: related to GCC 14 where -Wimplicit-function-declaration now raises an error
A workaround is to use -D_GNU_SOURCE
I try to dig where it is missing (zend_operators.h ?), but cannot find a proper place to add it (we already have tons of places where it is defined)
Would it be simpler to define it globally and earlier?
PHP Version
PHP 8.3
Operating System
Fedora 40 with GCC 14
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Zend/zend_operators.h と php.h をインクルードする configure のコンパイルチェックから始め、その後 Fedora 40 上の GCC 14 で失敗を再現してください。現在 _GNU_SOURCE がどこで定義されているかを追跡し、memrchr の宣言がない問題を修正するための適切なスコープを判断してください。報告された構成テストが workaround なしでコンパイルできれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c
- 領域
- build-system
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100