Skip to content

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

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

Closed
aotto1968 opened this issue Sep 30, 2022 · 1 comment · Fixed by #9647
Closed

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

aotto1968 opened this issue Sep 30, 2022 · 1 comment · Fixed by #9647

Comments

@aotto1968
Copy link

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

@petk
Copy link
Member

petk commented Jan 18, 2023

Hello, @aotto1968, can you create a step by step instructions how this happens exactly? For example, which extension are we talking about here and what steps are taken for the compilation?

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