Skip to content

php extension and "CFLAGS=.. -Og ..." #9645

Closed
@aotto1968

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions