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

pragma GCC diagnostic not allowed inside functions #14497

Closed
Jan1205 opened this issue Jun 7, 2024 · 9 comments
Closed

pragma GCC diagnostic not allowed inside functions #14497

Jan1205 opened this issue Jun 7, 2024 · 9 comments
Labels

Comments

@Jan1205
Copy link

Jan1205 commented Jun 7, 2024

Description

Description

Since PHP 8.2.20 with old compilers we have the following error:

/usr/local/src/php-8.2.20/ext/dom/document.c: In function ‘zim_DOMDocument_xinclude’:
/usr/local/src/php-8.2.20/ext/dom/document.c:1586:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1586:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1586:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1588:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1588:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1588:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c: In function ‘zim_DOMDocument_validate’:
/usr/local/src/php-8.2.20/ext/dom/document.c:1626:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1626:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1626:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1638:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1638:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1638:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c: In function ‘_dom_document_schema_validate’:
/usr/local/src/php-8.2.20/ext/dom/document.c:1673:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1673:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1673:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1678:4: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1678:4: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1678:4: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1684:4: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1684:4: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1684:4: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1705:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1705:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1705:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1726:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1726:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1726:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1732:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1732:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1732:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c: In function ‘_dom_document_relaxNG_validate’:
/usr/local/src/php-8.2.20/ext/dom/document.c:1803:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1803:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1803:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1810:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1810:2: error: #pragma GCC diagnostic not allowed inside functions
/usr/local/src/php-8.2.20/ext/dom/document.c:1810:2: error: #pragma GCC diagnostic not allowed inside functions
make: *** [ext/dom/document.lo] Fehler 1

Is there a chance to fix this? PHP 8.2.13 works for me.

PHP Version

PHP 8.2.20

Operating System

Unfortunately it is a very old system and version: gcc 4.1.2

see #11063

PHP Version

PHP 8.2.20

Operating System

No response

@devnexen
Copy link
Member

devnexen commented Jun 7, 2024

See the requirements to build from source.
Note that, in practice, it should work with gcc 4.8. @nielsdos is there any way to make small changes to comply with older toolchains ?

@Girgias
Copy link
Member

Girgias commented Jun 7, 2024

GCC 4.8 was released in March 2013, the toolchain is over 10 years old. Moreover, it is only shipped part of RHEL 7 which is EOL at the end of this month. I'm not sure if it makes sense for us to fix this.

EDIT: Ah, I'm realizing this about trying to compile on GCC 4.1.2, which was released in 2007

@devnexen
Copy link
Member

devnexen commented Jun 7, 2024

At worse, @Jan1205, the best would be to stick to the last php version your system can build until the migration of your infra is done (ref. to the original ticket) ?

@nielsdos
Copy link
Member

nielsdos commented Jun 7, 2024

The warnings are coming from the macros at https://github.com/php/php-src/blob/master/ext/libxml/php_libxml.h#L208 which is also in PHP 8.0 because it was part of a security fix.

DOM is not the only place where you'll encounter that issue. One "solution" is to check the version number of the compiler and make the diagnostic macro a no-op if the compiler is too old. But as said earlier, I'm not so sure we should support a compiler from 2007 while our docs specify a minimum compiler version that's much more recent than that.

@petk
Copy link
Member

petk commented Jun 9, 2024

As a side note, I'm not sure there has been a minimum version of GCC or Clang compilers defined anywhere for PHP yet. Because the Parle extension might have separate requirements.

But this is also very good news that compilers get some required minimum version so it is more clear what is needed to build PHP. And the code can get slightly more simplified to avoid some manual checks with ZEND_GCC_VERSION.

@nielsdos
Copy link
Member

nielsdos commented Jun 9, 2024

What do you think about making this macro a no-op on old GCC versions?

@petk
Copy link
Member

petk commented Jun 9, 2024

What do you think about making this macro a no-op on old GCC versions?

Hm, I'm really not sure what would that affect.

@nielsdos
Copy link
Member

nielsdos commented Jun 9, 2024

Note: I specifically meant the diagnostic macro, not the sanitize macro.

Copy link

No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.

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

No branches or pull requests

5 participants