Bug 709862 - dash-7 source RPM does not build
Summary: dash-7 source RPM does not build
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: distribution
Version: 2.0
Hardware: Unspecified
OS: Linux
urgent
high
Target Milestone: ---
: ---
Assignee: mick
QA Contact: Frantisek Reznicek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-01 19:31 UTC by mick
Modified: 2015-11-16 01:13 UTC (History)
4 users (show)

Fixed In Version: qpid-cpp-mrg-0.10-8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-07 17:43:10 UTC
Target Upstream Version:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.