Opened 4 years ago

Closed 4 years ago

#4922 closed defect (fixed)

Regression introduced in probe_cc

Reported by: jyavenard Owned by:
Priority: important Component: build system
Version: git-master Keywords: regression
Cc: gajjanagadde@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

A regression was introduced by commit 060102389e572abb2beaed3b9f5e1036aeea43f1

" configure: do not fork off grep subprocess in probe_cc

grep is not required for the functionality in this instance.
This avoids an unnecessary fork, and also avoids a duplicated dumpversion call.
Furthermore, it also corrects behavior when no minor version number is present, see e.g
https://github.com/joyent/node/pull/25671.


Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

"

It changed from:

if ! $_cc -dumpversion | grep -q '2\.'; then

_depflags='-MMD -MF $(@:.o=.d) -MT $@'

fi

to:

case $gcc_basever in

2*) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;

esac

So _depflags_ prior commit 060102389e572abb2beaed3b9f5e1036aeea43f1 was set when gcc version was != 2

following this commit it is set if version is 2.

This cause to have defined as CCDEP to
CCDEP=$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/\#.*/d" -e "s,:space:?*$(*F)
.o,$(@D)/$(*F).o," > $(@:.o=.d)
ASDEP=$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/\#.*/d" -e "s,:space:?*$(*F)
.o,$(@D)/$(*F).o," > $(@:.o=.d)

Making the generated config.mak unusable in scripts (makefile or qmake .pro) dependent on it.

One could argue that bothering for gcc <= 4.2 is rather pointless.

It also exposes an issue when the DEPCMD is to be evaluated:
it is set by default to
DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/\#.*/d" -e "s,:space:?*$(*F)
.o,$(@D)/$(*F).o," > $(@:.o=.d)'

this is never evaluated properly if we ever need to.

Attachments (1)

0001-Fix-configure-when-using-gcc.patch (828 bytes) - added by jyavenard 4 years ago.
Proposed fix

Download all attachments as: .zip

Change History (6)

comment:1 in reply to: ↑ description ; follow-up: Changed 4 years ago by cehoyos

  • Component changed from undetermined to build system
  • Keywords regression added
  • Priority changed from normal to important
  • Version changed from unspecified to git-master

Replying to jyavenard:

Making the generated config.mak unusable in scripts (makefile or qmake .pro) dependent on it.

Could you elaborate and explain how it is unusable? How can I reproduce the issue?

Changed 4 years ago by jyavenard

Proposed fix

comment:2 in reply to: ↑ 1 Changed 4 years ago by jyavenard

Replying to cehoyos:

Replying to jyavenard:

Making the generated config.mak unusable in scripts (makefile or qmake .pro) dependent on it.

Could you elaborate and explain how it is unusable? How can I reproduce the issue?

the issue occurs when you attempt to include the config.mak in another Makefile or a qmake makefile.pro ; it will yield syntax errors such as:
"
/home/buildslave/mythtv/ffmpeg_resync-debian-jessie-32bit/build/source/mythtv/config.mak:81: Missing closing " quote
/home/buildslave/mythtv/ffmpeg_resync-debian-jessie-32bit/build/source/mythtv/config.mak:84: Missing closing " quote
/home/buildslave/mythtv/ffmpeg_resync-debian-jessie-32bit/build/source/mythtv/config.mak:97: Missing closing " quote
/home/buildslave/mythtv/ffmpeg_resync-debian-jessie-32bit/build/source/mythtv/config.mak:81: Missing closing " quote
/home/buildslave/mythtv/ffmpeg_resync-debian-jessie-32bit/build/source/mythtv/config.mak:84: Missing closing " quote
/home/buildslave/mythtv/ffmpeg_resync-debian-jessie-32bit/build/source/mythtv/config.mak:97: Missing closing " quote
"

because config.mak contains unevaluated lines such as:

CCDEP=$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)
CXXDEP=
CCDEP_FLAGS=-MM
ASDEP=$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)
ASDEP_FLAGS=-MM
CC_DEPFLAGS=
AS_DEPFLAGS=
HOSTCC=gcc
HOSTLD=gcc
HOSTCFLAGS=  -std=c99 -Wall -O3
HOSTCPPFLAGS= -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
HOSTEXESUF=
HOSTLDFLAGS= 
HOSTLIBS=-lm
DEPHOSTCC=gcc
DEPHOSTCCFLAGS= $(HOSTCCFLAGS)
HOSTCCDEP=$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)

note CCDEP : it contains unevaluated expressions.

It is easy to reproduce, run configure scripts and look at the generated config.mak (you need to be using gcc as compiler, typically linux)

The bug only exposes an issue with the DEPCMD expression that isn't properly evaluated here:

set_ccvars(){
    eval ${1}_C=\${_cc_c-\${${1}_C}}
    eval ${1}_E=\${_cc_e-\${${1}_E}}
    eval ${1}_O=\${_cc_o-\${${1}_O}}

    if [ -n "$_depflags" ]; then
        eval ${1}_DEPFLAGS=\$_depflags
    else
        eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
        eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
        eval DEP${1}FLAGS=\$_flags
    fi
}

I have no solution to this problem however. it appears to have been broken for a long time (before 2012)

comment:3 Changed 4 years ago by Cigaes

There is indeed a bug that Ganesh is about to fix, but please note that including config.mak from foreign build systems is not supported. If it works for now, good for you, but can stops working due to an intentional change any time.

comment:4 Changed 4 years ago by gajjanag

comment:5 Changed 4 years ago by gajjanag

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.