Issue with undefined _GNU_SOURCE

Đang mở
#13,825 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
c
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với Zend/zend_operators.h và bước kiểm tra biên dịch của configure có include php.h, sau đó tái hiện lỗi với GCC 14 trên Fedora 40. Truy vết nơi _GNU_SOURCE hiện được định nghĩa và xác định phạm vi phù hợp để sửa khai báo memrchr bị thiếu. Hoàn tất khi bài kiểm tra cấu hình được báo cáo biên dịch được mà không cần workaround.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug Category: Build System Status: Needs Triage
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

Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
103

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của php/php-src

Tất cả issue của php/php-src

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.