Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error for installing intl extension #17107

Open
adeshmrane opened this issue Dec 10, 2024 · 4 comments
Open

Getting error for installing intl extension #17107

adeshmrane opened this issue Dec 10, 2024 · 4 comments

Comments

@adeshmrane
Copy link

adeshmrane commented Dec 10, 2024

Description

I am trying to compile PHP 8.4.1 on AlmaLinux release 8.10

When I enable the IMAPintl extension with the --enable-intl=shared option i ran into below errors.

/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h:437:2: error: expected ‘;’ after struct definition
 } max_align_t;
  ^
  ;
/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h:437:1: error: missing type-name in typedef-declaration
 } max_align_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h:437:14: error: expected unqualified-id before ‘;’ token
 } max_align_t;
              ^
<command-line>: error: expected unqualified-id before ‘void’
In file included from /setups/php-8.4.1/Zend/zend_portability.h:798,
                 from /setups/php-8.4.1/Zend/zend_types.h:25,
                 from /setups/php-8.4.1/ext/intl/intl_convertcpp.h:23,
                 from /setups/php-8.4.1/ext/intl/intl_convertcpp.cpp:17:
/usr/include/c++/8/cstddef:56:11: error: expected ‘;’ before ‘void’
   using ::max_align_t;
           ^
           ;
/usr/include/c++/8/cstddef:56:22: error: expected unqualified-id before ‘;’ token
   using ::max_align_t;
                      ^
<command-line>: error: expected unqualified-id before ‘void’
/setups/php-8.4.1/Zend/zend_portability.h:800:14: note: in expansion of macro ‘max_align_t’
 typedef std::max_align_t zend_max_align_t;
              ^~~~~~~~~~~
In file included from /setups/php-8.4.1/main/php.h:31,
                 from /setups/php-8.4.1/ext/intl/intl_convertcpp.cpp:20:
/setups/php-8.4.1/Zend/zend.h:240:2: error: ‘zend_max_align_t’ does not name a type; did you mean ‘max_align_t’?
  zend_max_align_t align;
  ^~~~~~~~~~~~~~~~
  max_align_t

I am using gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22)

PHP Version

php 8.4.1

Operating System

AlmaLinux release 8.10

@iluuu1994
Copy link
Member

Getting error for installing IMAP extension

To clarify: You mean intl, not imap? The imap extension now lives at https://github.com/php/pecl-mail-imap.

@cmb69
Copy link
Member

cmb69 commented Dec 10, 2024

#include <stddef.h>

vs

# include <cstddef>

I guess.

@cmb69 cmb69 changed the title Getting error for installing IMAP extension Getting error for installing intl extension Dec 10, 2024
@cmb69
Copy link
Member

cmb69 commented Dec 13, 2024

This is caused by #15096. Need to double check whether including <cstddef> is really necessary (would better be avoided if possible).

@cmb69 cmb69 self-assigned this Dec 13, 2024
@cmb69
Copy link
Member

cmb69 commented Dec 14, 2024

I've checked that more thoroughly, and the problem is that stddef.h does not define max_align_t at all on Windows (regardless of the language standard specified). So prior to ab449a7 C builds would take the fallback definition (while C++ builds would fail). The fix was based on the assumption that additionally including cstdef as extern C++ would not interfere with the already included stddef.h, but that was apparently presumptuous; while GCC 8.5 is a bit old, it is not ancient.

An alternative fix would have been to just not relying on max_align_t being defined on Windows, instead of including cstddef for C++ builds. The fallback definition likely would have been okay in all circumstances for Windows (at least MSVC), since its size is 8, what matches the max_align_t definition in cstddef (where it is defined as double; note that long double is identical to double on Windows).

But dropping the cstddef include now might introduce an ABI break (what would be very bad). So I don't know what to do. Any suggestions welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants