Bug 1866 - waf treats CXXFLAGS differently during configure and build
waf treats CXXFLAGS differently during configure and build
Status: NEEDINFO
Product: ns-3
Classification: Unclassified
Component: build system
ns-3-dev
All All
: P5 normal
Assigned To: Gustavo J. A. M. Carneiro
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-01 23:23 EST by Peter Barnes
Modified: 2014-09-24 00:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Barnes 2014-03-01 23:23:05 EST
CXXFLAGS given at configure time are correctly added to compile commands:

  $ CXXFLAGS="-Wstrict-overflow=3" ./waf configure 
  $ waf build -v
  [ 742/2050] cxx: src/stats/model/uinteger-8-probe.cc -> build/optimized/default/src/stats/model/uinteger-8-probe.cc.1.o
20:21:19 runner ['/usr/bin/g++', '-fstrict-overflow', '-Wstrict-overflow=4', '-fPIC', '-I.', '-I../../..', '-I/sw/include', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_MPI=1', '-DHAVE_SQLITE3=1', '-DHAVE_GSL=1', '../../../src/stats/model/uinteger-8-probe.cc', '-c', '-o', 'src/stats/model/uinteger-8-probe.cc.1.o']

Notice that the argument to the gcc argument is passed correctly:  '-Wstrict-overflow=4'

CXXFLAGS with arguments given at build time have the argument value omitted:

  $ waf build -v
  [ 742/2050] cxx: src/stats/model/uinteger-8-probe.cc -> build/optimized/default/src/stats/model/uinteger-8-probe.cc.1.o
20:21:19 runner ['/usr/bin/g++', '-fstrict-overflow', '-Wstrict-overflow', '-fPIC', '-I.', '-I../../..', '-I/sw/include', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_MPI=1', '-DHAVE_SQLITE3=1', '-DHAVE_GSL=1', '../../../src/stats/model/uinteger-8-probe.cc', '-c', '-o', 'src/stats/model/uinteger-8-probe.cc.1.o']

Notice that the argument is missing: '-Wstrict-overflow'
Comment 1 Tom Henderson 2014-06-03 10:33:02 EDT
(In reply to Peter Barnes from comment #0)
> CXXFLAGS given at configure time are correctly added to compile commands:
> 
>   $ CXXFLAGS="-Wstrict-overflow=3" ./waf configure 
>   $ waf build -v
>   [ 742/2050] cxx: src/stats/model/uinteger-8-probe.cc ->
> build/optimized/default/src/stats/model/uinteger-8-probe.cc.1.o
> 20:21:19 runner ['/usr/bin/g++', '-fstrict-overflow', '-Wstrict-overflow=4',
> '-fPIC', '-I.', '-I../../..', '-I/sw/include', '-DHAVE_SYS_IOCTL_H=1',
> '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_MPI=1', '-DHAVE_SQLITE3=1',
> '-DHAVE_GSL=1', '../../../src/stats/model/uinteger-8-probe.cc', '-c', '-o',
> 'src/stats/model/uinteger-8-probe.cc.1.o']
> 
> Notice that the argument to the gcc argument is passed correctly: 
> '-Wstrict-overflow=4'
> 
> CXXFLAGS with arguments given at build time have the argument value omitted:
> 
>   $ waf build -v
>   [ 742/2050] cxx: src/stats/model/uinteger-8-probe.cc ->
> build/optimized/default/src/stats/model/uinteger-8-probe.cc.1.o
> 20:21:19 runner ['/usr/bin/g++', '-fstrict-overflow', '-Wstrict-overflow',
> '-fPIC', '-I.', '-I../../..', '-I/sw/include', '-DHAVE_SYS_IOCTL_H=1',
> '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_MPI=1', '-DHAVE_SQLITE3=1',
> '-DHAVE_GSL=1', '../../../src/stats/model/uinteger-8-probe.cc', '-c', '-o',
> 'src/stats/model/uinteger-8-probe.cc.1.o']
> 
> Notice that the argument is missing: '-Wstrict-overflow'

In the example above, were you passing anything in CXXFLAGS in the second case, to try to override it?  How was your second case configured?  

I believe that waf uses the CXXFLAGS registered at configure time and stored in the build/c4che/_cache.py when it is time to build, and that users cannot override it by passing a new CXXFLAGS at build time.  I think this is just how waf works (configure governs the build).
Comment 2 Peter Barnes 2014-09-24 00:10:06 EDT
Suggest that waf should complain at build time if it receives options only valid at configure time.