Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Building OpenFlow 1.0 dissector for Wireshark 1.10.0 on Ubun

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 10 Jul 2013 14:52:05 -0700
On Jul 10, 2013, at 2:18 PM, Phiho Hoang <hohoangphi@xxxxxxxxx> wrote:

> Greetings,
> 
> Wireshark 1.10.0 was built from source on Ubuntu 13.04, (with gcc 4.7.3)
> 
> OpenFlow 1.0 dissector was also built from source using scons with this modification in 'Sconstruct' (copied from Sconstruct under Ubuntu 12.04):
> 
> # env = Environment(LINKFLAGS = '-flat_namespace')
> env = Environment()
> 
> to work around this error:
> 
> $ scons install
> ...
> scons: Building targets ...
> gcc -o openflow.so -flat_namespace -shared packet-openflow.os plugin.os -L/usr/lib -L/usr/local/lib
> gcc: error: unrecognized command line option '-flat_namespace'
> scons: *** [openflow.so] Error 1
> ...

To quote the GCC man page on my machine:


	   Darwin Options -all_load  -allowable_client	-arch
	   -arch_errors_fatal -arch_only  -bind_at_load  -bundle
	   -bundle_loader -client_name	-compatibility_version
	   -current_version -dead_strip -dependency-file  -dylib_file
	   -dylinker_install_name -dynamic  -dynamiclib
	   -exported_symbols_list -filelist  -flat_namespace
	...

   Options for Linking
       These options come into play when the compiler links object files into
       an executable output file.  They are meaningless if the compiler is not
       doing a link step.

       In addition to the options listed below, Apple's GCC also accepts and
       passes nearly all of the options defined by the linker ld and by the
       library tool libtool.  Common options include -framework, -dynamic,
       -bundle, -flat_namespace, and so forth.	See the ld and libtool man
       pages for further details.

		...

       -allowable_client  client_name

		...

       -flat_namespace
		...

	   These options are passed to the Darwin linker.  The Darwin linker
	   man page describes them in detail.

The GCC man page on my Ubuntu 12.10 virtual machine does not say anything about -flat_namespace; unless it was a recent addition to GCC-for-Linux, the line

	env = Environment(LINKFLAGS = '-flat_namespace')

belongs in a configuration file *ONLY* when building on OS X for OS X (or maybe iOS), *NOT* when building on Linux for Linux, because -flat_namespace is an OS X-specific option.