Bugzilla – Bug 1815
python bindings will not compile on OS X Mavericks
Last modified: 2013-12-19 01:27:02 UTC
Reported by Alex Afanasyev, when using clang on Mavericks (Apple gcc does not exhibit the problem): --------- extract --------- src/network/bindings/ns3module.cc:21748:10: error: no member named '_Ios_Openmode' in namespace 'std' std::_Ios_Openmode mode; ~~~~~^ ---- end of the extract ---- This can be fixed if manually replace std::_Ios_Openmode with (as it suppose to be) std::ios::openmode in src/network/bindings/modulegen__gcc_*.py
I was able to reproduce this on a local machine. The gist of the problem is that when our code includes: std::ios::openmode or std::ios_base::openmode (e.g. src/network/utils/pcap-file.h) this is converted by our toolchain to bindings that include std::_Ios_Openmode mode, e.g. [param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')]) pybindgen converts this (in ns3module.cc) to std::_Ios_Openmode which is defined (as a typedef) in libraries linked by g++, but clang does not support this. A manual replace of std::_Ios_Openmode with std::ios_base::openmode will allow clang to compile the bindings, as Alex reported. ----- My sense is that we'll need to fix this (at least at the moment) with pybindgen or by customizations in ns-3 bindings that make this replacement. I don't have a sense yet whether this is better addressed in pybindgen or by some customizations within ns-3 (to either create a typedef for clang, or use of an alias of some type).
What happens here is that this is probably the case of gcc's libstd++ having a typedef like: typedef std::_Ios_Openmode std::ios_base::openmode; Or something like that. GCCXML then gives us std::_Ios_Openmode instead of std::ios_base::openmode as type name. This is similar to the problem of typedef unsigned long uint32_t. GCCXML always gives the original type name and we have no access to the name it has been aliased to. So I added another bit of code to deal with this better.
Created attachment 1739 [details] patch bundle Here's the patch as a mercurial bundle. I'm at my work computer, so I don't have things setup to push to ns-3 here. If someone could push on my behalf, that would help.
pushed Gustavo's patch in changeset affa046899f3