[php-src] Issue #8081: `PHP_CHECK_PDO_INCLUDES` generates mangled output on PHP 8.0 and 8.1
| From: | NattyNarwhal | Date: | Fri, 11 Feb 2022 17:15:14 +0000 |
| Subject: | [php-src] Issue #8081: `PHP_CHECK_PDO_INCLUDES` generates mangled output on PHP 8.0 and 8.1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239684@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8081
Author: NattyNarwhal
### Description
I've been trying to modernize the build system of an extension (specifically PDO_IBM, so we can
do better CI), including [replacing an old and crufty PDO
check](https://github.com/php/pecl-database-pdo_ibm/pull/6/commits/6510dd4e9a4de052763693bcce8ddc78945eeafc)
(that was having issues with how [setup-php](https://github.com/shivammathur/setup-php) in an action
set up the PHP prefix) with the new hotness,
PHP_CHECK_PDO_INCLUDES that the built-in
extensions have been using for a long while now.
However, not all is rosy. While the build works after changing to use the PHP macro instead of the
old logic in 7.3, 7.4, and 8.1, it does not work in 8.0, and I can reproduce that with Fedora's
build of 8.0.
I have some quick notes and comparisons [in a
gist](https://gist.githubusercontent.com/NattyNarwhal/d97ef62805263056245d0e4784899ed1/raw/84a1980fab7ab93cc8b7ad07bbc968db9a42a5d1/gistfile1.txt),
comparing CI matrix results + testing on my local system with 8.0 and reverting my change to use the
old style of PDO include check. The outputs are from libtool normalizing the outputs plus what the
generated Makefile looks like. Notably, the spot where there should the path to the extension is
empty when using the PHP_CHECK_PDO_INCLUDES. I suspect what then happens is gcc looks
for the next arg for the include path, and eats that. In the 8.1 case, it seems it eats
-c, which obviously is Not Good for an object being built, giving you output like this:
```
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crt1.o: in function
`_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: /tmp/ccBcJS2Z.o: in function `zm_startup_pdo_ibm':
/home/calvin/src/pecl-database-pdo_ibm/pdo_ibm.c:131: undefined reference to
`php_pdo_get_dbh_ce'
/usr/bin/ld: /home/calvin/src/pecl-database-pdo_ibm/pdo_ibm.c:131: undefined reference to
`zend_declare_class_constant_long'
/usr/bin/ld: /home/calvin/src/pecl-database-pdo_ibm/pdo_ibm.c:132: undefined reference to
`php_pdo_get_dbh_ce'
[...]
```
8.1 is also suffering from this issue, but it seems it's eating a -D, which is not
ideal but papers over the issue. 7.x seems fine. I'm wondering if this might be an issue in PHP
or if there's an issue in the extension's build script I'm missing
### PHP Version
PHP 8.0.15
### Operating System
Fedora 35