[Python][TR1] Broken in V1.35 if Boost.Python used with Boost.TR1

Hi all, compiling Boost Python while having the Boost TR1 headers in the include path is broken in V1.35 (trunk as well, BTW), at least while using VC8.1 on Windows or gcc on Cygwin. The simplest way to reproduce this is: create a file test.cpp: #include <boost/python.hpp> Compile it with: cl -c -MDd -I$PYTHON_ROOT\include -I$BOOST_ROOT -I$BOOST_ROOT\boost\tr1\tr1 test.cpp or gcc -c -I$PYTHON_ROOT/include -I$BOOST_ROOT -I$BOOST_ROOT/boost/tr1/tr1 test.cpp voila! Lots of errors. Regards Hartmut

Hartmut Kaiser <hartmut.kaiser <at> gmail.com> writes:
Hi all,
compiling Boost Python while having the Boost TR1 headers in the include path is broken in V1.35 (trunk as well, BTW), at least while using VC8.1 on Windows or gcc on Cygwin.
Sounds similar to the problem i've had with TR1/Fusion (http://article.gmane.org/gmane.comp.lib.boost.devel/171545) ? . Your simple example compiles if you include <functional> before python.hpp.

Richard Webb wrote:
Hartmut Kaiser <hartmut.kaiser <at> gmail.com> writes:
Hi all,
compiling Boost Python while having the Boost TR1 headers in the include path is broken in V1.35 (trunk as well, BTW), at least while using VC8.1 on Windows or gcc on Cygwin.
Sounds similar to the problem i've had with TR1/Fusion (http://article.gmane.org/gmane.comp.lib.boost.devel/171545) ? . Your simple example compiles if you include <functional> before python.hpp.
I think I might have missed that post sorry :-( The same possible fix applies: replace <utility> in the fusion headers with <boost/config/no_tr1/utility.hpp>. Joel, does this work for you? John.

John Maddock <john <at> johnmaddock.co.uk> writes:
I think I might have missed that post sorry
You did actually reply (http://article.gmane.org/gmane.comp.lib.boost.devel/171552). There were no suggestions about fixing the problem though.
The same possible fix applies: replace <utility> in the fusion headers with <boost/config/no_tr1/utility.hpp>.
Making that change in fusion/support/tag_of.hpp fixes the errors that occur when including <boost/fusion/tuple.hpp> :)

Richard Webb wrote:
compiling Boost Python while having the Boost TR1 headers in the include path is broken in V1.35 (trunk as well, BTW), at least while using VC8.1 on Windows or gcc on Cygwin.
Sounds similar to the problem i've had with TR1/Fusion (http://article.gmane.org/gmane.comp.lib.boost.devel/171545) ? .
Does this mean it's rather a Boost.TR1 problem?
Your simple example compiles if you include <functional> before python.hpp.
Yeah, I know. Regards Hartmut

Hartmut Kaiser wrote:
Richard Webb wrote:
compiling Boost Python while having the Boost TR1 headers in the include path is broken in V1.35 (trunk as well, BTW), at least while using VC8.1 on Windows or gcc on Cygwin.
Sounds similar to the problem i've had with TR1/Fusion (http://article.gmane.org/gmane.comp.lib.boost.devel/171545) ? .
Does this mean it's rather a Boost.TR1 problem?
Sigh... it's a problem with TR1 modifying existing std lib headers :-( Boost.TR1 needs to include <boost/function.hpp> to implement <functional>, but <boost/function.hpp> needs to include <functional>. It's only possible to fix it inside TR1 if you can tell by some mechanism that "we're in the middle of including <boost/function/*.hpp> and haven't finished yet", which is basically what including <boost/config/no_tr1/functional.hpp> gives you. John.

Hartmut Kaiser wrote:
Hi all,
compiling Boost Python while having the Boost TR1 headers in the include path is broken in V1.35 (trunk as well, BTW), at least while using VC8.1 on Windows or gcc on Cygwin.
The simplest way to reproduce this is:
create a file test.cpp:
#include <boost/python.hpp>
Hi Harmut, this is nasty because TR1 and Boost.Function have a mutual (circular) dependency :-( The reduced test case is: #include <boost/function/function0.hpp> while: #include <boost/function.hpp> works just fine. Doug the following patch fixes this problem, is this acceptable to you? Index: C:/data/boost/boost/trunk/boost/function/detail/prologue.hpp =================================================================== --- C:/data/boost/boost/trunk/boost/function/detail/prologue.hpp (revision 44417) +++ C:/data/boost/boost/trunk/boost/function/detail/prologue.hpp (working copy) @@ -11,7 +11,7 @@ #define BOOST_FUNCTION_PROLOGUE_HPP # include <cassert> # include <algorithm> -# include <functional> // unary_function, binary_function +# include <boost/config/no_tr1/functional.hpp> // unary_function, binary_function # include <boost/throw_exception.hpp> # include <boost/config.hpp> # include <boost/function/function_base.hpp> HTH, John.

On Apr 17, 2008, at 5:18 AM, John Maddock wrote:
Hi Harmut, this is nasty because TR1 and Boost.Function have a mutual (circular) dependency :-(
The reduced test case is:
#include <boost/function/function0.hpp>
while:
#include <boost/function.hpp>
works just fine.
Yuck.
Doug the following patch fixes this problem, is this acceptable to you?
Index: C:/data/boost/boost/trunk/boost/function/detail/prologue.hpp =================================================================== --- C:/data/boost/boost/trunk/boost/function/detail/prologue.hpp (revision 44417) +++ C:/data/boost/boost/trunk/boost/function/detail/prologue.hpp (working copy) @@ -11,7 +11,7 @@ #define BOOST_FUNCTION_PROLOGUE_HPP # include <cassert> # include <algorithm> -# include <functional> // unary_function, binary_function +# include <boost/config/no_tr1/functional.hpp> // unary_function, binary_function # include <boost/throw_exception.hpp> # include <boost/config.hpp> # include <boost/function/function_base.hpp>
Yes, please commit. Thanks! - Doug
participants (4)
-
Douglas Gregor
-
Hartmut Kaiser
-
John Maddock
-
Richard Webb