Bug 709862

Summary: dash-7 source RPM does not build
Product: Red Hat Enterprise MRG Reporter: mick <mgoulish>
Component: distributionAssignee: mick <mgoulish>
Status: CLOSED CURRENTRELEASE QA Contact: Frantisek Reznicek <freznice>
Severity: high Docs Contact:
Priority: urgent    
Version: 2.0CC: esammons, freznice, iboverma, tross
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: qpid-cpp-mrg-0.10-8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-07 17:43:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description mick 2011-06-01 19:31:34 UTC
Building the dash-7 source rpm using the command 

rpmbuild --recompile ./qpid-cpp-mrg-0.10-7.el5.src.rpm

fails at the file 

qpid/broker/SessionState.cpp

because there is a variable, called "unique" which is unused.
which generates a warning
which becomes an error
which stops the build.
because we always set -Werror in gcc.

BREW FAILED TO CATCH THIS -- because when it did the configuration, it decided that gcc did not support the -Werror flag.  So it didn't use that flag.
So the warning just scrolled past, as it went on its merry way.

NOTE -- the variable is NOT unused in 'normal' development builds -- because it appears in an assertion.  But in a production build -- the assertion is whitespace, and the variable decl is hanging out there all by itself.

I am doing a mock build to try to find what caused the configuration failure in brew.

Comment 1 mick 2011-06-02 11:25:23 UTC
/*---------------------------------------
   root cause
---------------------------------------*/

In the brew mock build, just before the configure script is run in the cpp directory, the CXXFLAGS environment variable is set this way:

  export CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DNDEBUG -O3'

This environment variable affects the operation of the GCC compiler.

Then, when the configure script is run, GCC reports that it will NOT honor the -Werror flag.  
So that flag is never used.  
So warnings are not treated as errors.
So we did not notice the warning saying that a variable in one cpp function was unused.

~~~   HOWEVER   ~~~

In the rpmbuild process, when I give the normal command:

rpmbuild --recompile /path/to/qpid-cpp-mrg-0.10-7.el5.src.rpm

it sets a *different* CXXFLAGS value:
  CXXFLAGS='-O2 -g -m64 -mtune=generic -DNDEBUG -O3'


This causes GCC to report that it *will* honor the -Werror flag -- so the build fails.  




The important difference is the absence of the -Wall flag.
If you remove that flag from the brew mock build, i.e. if it were to set this value for CXXFLAGS:


    export CXXFLAGS='-O2 -g -pipe       -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DNDEBUG -O3'


Then everything works right.


It looks like there is an undocumented relationship between -Wall and -Werror in gcc.   i.e. -Wall disables -Werror

Comment 2 Ted Ross 2011-06-06 17:25:43 UTC
Fixed upstream in revision 1127947

Comment 3 Frantisek Reznicek 2011-06-08 14:16:34 UTC
Both qpid-cpp-mrg-0.10-8.el5 qpid-cpp-0.10-6.el6 now build ok 
- rpmbuild way(-Wall) 
- custom build way (CXXFLAGS w/o -Wall).

Tested on RHEL5.6 / 6.1 i/x.

-> VERIFIED