View | Details | Raw Unified | Return to bug 2938
Collapse All | Expand All

(-)a/doc/tutorial/source/getting-started.rst (+29 lines)
 Lines 348-353    Link Here 
348
simulator did not build successfully or that it will provide wrong 
348
simulator did not build successfully or that it will provide wrong 
349
results for the modules listed as being built.
349
results for the modules listed as being built.
350
350
351
Handling build errors
352
+++++++++++++++++++++
353
354
|ns3| releases are tested against the most recent C++ compilers available
355
in the mainstream Linux and MacOS distributions at the time of the release.
356
However, over time, newer distributions are released, with newer compilers,
357
and these newer compilers tend to be more pedantic about warnings.  |ns3|
358
configures its build to treat all warnings as errors, so it is sometimes
359
the case, if you are using an older release version on a newer system,
360
that a compiler warning will cause the build to fail.
361
362
For instance, ns-3.28 was released prior to Fedora 28, which included
363
a new major version of gcc (gcc-8).  Building ns-3.28 or older releases
364
on Fedora 28, when Gtk2+ is installed, will result in an error such as:
365
366
::
367
368
  /usr/include/gtk-2.0/gtk/gtkfilechooserbutton.h:59:8: error: unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Werror=parentheses]
369
   void (*__gtk_reserved1);
370
371
In releases starting with ns-3.28.1, an option is available in Waf to work
372
around these issues.  The option disables the inclusion of the '-Werror' 
373
flag to g++ and clang++.  The option is '--disable-werror' and must be
374
used at configure time; e.g.:
375
376
::
377
378
  ./waf configure --disable-werror --enable-examples --enable-tests
379
351
Building with bake
380
Building with bake
352
++++++++++++++++++
381
++++++++++++++++++
353
382
(-)a/waf-tools/cflags.py (+9 lines)
 Lines 159-164    Link Here 
159
	opt.add_option('--check-profile',
159
	opt.add_option('--check-profile',
160
		       help=('print out current build profile'),
160
		       help=('print out current build profile'),
161
		       default=False, dest='check_profile', action="store_true")
161
		       default=False, dest='check_profile', action="store_true")
162
	opt.add_option('--disable-werror',
163
		       help=('disable -Werror flag (warnings treated as errors'),
164
		       default=False, dest='disable_werror', action="store_true")
162
def configure(conf):
165
def configure(conf):
163
	cc = conf.env['COMPILER_CC'] or None
166
	cc = conf.env['COMPILER_CC'] or None
164
	cxx = conf.env['COMPILER_CXX'] or None
167
	cxx = conf.env['COMPILER_CXX'] or None
 Lines 181-186    Link Here 
181
	optimizations = compiler.get_optimization_flags(opt_level)
184
	optimizations = compiler.get_optimization_flags(opt_level)
182
	debug, debug_defs = compiler.get_debug_flags(dbg_level)
185
	debug, debug_defs = compiler.get_debug_flags(dbg_level)
183
	warnings = compiler.get_warnings_flags(warn_level)
186
	warnings = compiler.get_warnings_flags(warn_level)
187
188
        if Options.options.disable_werror:
189
                try:
190
                        warnings.remove ('-Werror')
191
                except ValueError:
192
                        pass
184
	
193
	
185
	if cc and not conf.env['CCFLAGS']:
194
	if cc and not conf.env['CCFLAGS']:
186
		conf.env.append_value('CCFLAGS', optimizations)
195
		conf.env.append_value('CCFLAGS', optimizations)

Return to bug 2938