[php-src] Issue #9645: php extension and "CFLAGS=.. -Og ..."
| From: | aotto1968 | Date: | Fri, 30 Sep 2022 07:55:04 +0000 |
| Subject: | [php-src] Issue #9645: php extension and "CFLAGS=.. -Og ..." | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242500@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9645
Author: aotto1968
### Description
Hi, I maintain a PHP extension and recognize after the embedding of the PHP autoconf extension a bug
in the makefile:
```
> grep -- '-g\>' Makefile
CFLAGS = -g g -Wall -Wcast-align -Wfatal-errors -O0
CXXFLAGS = -g g -Wall -Wcast-align -Wfatal-errors -g -O0
```
→ as you see the
-g g is invalid, the question is: where it comes from ?
I add some debug prints into the **configure** and end up with:
```
checking if debug is enabled... yes
checking if zts is enabled... no
44 ++++++++++++++++++++ CFLAGS=-g -Og -Wall -Wcast-align -Wfatal-errors
55 ++++++++++++++++++++ CFLAGS=-g g -Wall -Wcast-align -Wfatal-errors
checking for gawk... gawk
checking for 'ZTS'... no
```
the problem in configure was the **SED** ... it does NOT recognize the -Og option :
```
if test "$PHP_DEBUG" = "yes"; then
PHP_DEBUG=1
ZEND_DEBUG=yes
echo "44 ++++++++++++++++++++ CFLAGS=$CFLAGS"
CFLAGS=echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'
CXXFLAGS=echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'
echo "55 ++++++++++++++++++++ CFLAGS=$CFLAGS"
if test "$GCC" = "yes" || test "$ICC" = "yes"; then
CFLAGS="$CFLAGS -O0"
CXXFLAGS="$CXXFLAGS -g -O0"
fi
if test "$SUNCC" = "yes"; then
if test -n "$auto_cflags"; then
CFLAGS="-g"
CXXFLAGS="-g"
else
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CFLAGS -g"
fi
fi
else
PHP_DEBUG=0
ZEND_DEBUG=no
fi
```
the source is from **configure.ac** created by **phpize**
### PHP Version
PHP 8.1.10
### Operating System
openSUSE Tumbleweed