[C++-sig] Problem compiling V2 tests.

David Abrahams dave at boost-consulting.com
Sun Aug 4 05:43:27 CEST 2002


[Paul, this guy is reporting some strange PP behavior on a particular build
of GCC -- any clues?]

Hi Tim,

From: "Tim Field" <Tim.Field at mcs.vuw.ac.nz>


> Hi there,
>
> I'm having trouble compiling Boost.Python V2 from the current CVS sources
> (using GCC 3.1 on a P4 running NetBSD 1.6D).  I downloaded and tried to
> compile the sources as per instructions in:
>
>     http://mail.python.org/pipermail/c++-sig/2002-May/001100.html
>
> While I'm able to compile libbpl.so without any errors, compiling any of
> the tests or using it myself gives errors in bases.hpp (which is included
> by module.hpp).
>
> For example, if I try compiling this simple file:
>
> ---
> #include <boost/python/module.hpp>
>
> BOOST_PYTHON_MODULE_INIT(test)
> {
>     boost::python::module m("test");
> }
> ---
>
> then I get the following output (where I've used [...] to shorten the
> lines):
>
> ---
> g++ -I[...]/boost -I[...]/include/python2.2 -c -o Test.o Test.cpp
> In file included from [...]/boost/boost/python/class_fwd.hpp:10,
>                  from [...]/boost/boost/python/module.hpp:12,
>                  from mine.cpp:1:
> [...]/boost/boost/python/bases.hpp:15: parse error before numeric
constant
> [...]/boost/boost/python/bases.hpp:20: Internal compiler error in
>            resume_binding_level, at cp/decl.c:614
> Please submit a full bug report, with preprocessed source if appropriate.
> See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
> gmake: *** [Test.o] Error 1

The fact that there's an internal compiler error should be a pretty strong
hint that this is a bug in your compiler. Since I test with GCC 3.1
regularly on at least 2 platforms, this is a bug in your particular GCC 3.1
configuration, specifically in the preprocessor.

> ---
>
> The preprocessor gives the following output for bases.hpp:
>
> ---
> namespace boost { namespace python {
>
>   template<typename 0 = ::boost::mpl::null_argument,
>            typename B1 = ::boost::mpl::null_argument,
>            typename B2 = ::boost::mpl::null_argument,
>            [...]
>            typename B14 = ::boost::mpl::null_argument>
>
>   struct bases : ::boost::mpl::type_list<0, B1, B2, [...], B14>::type {};


Yep, you've got a preprocessor bug. That should be "typename B0 = ..."
I suggest (strongly!) that you report the bug as specified by the error
message, then consider ways to rebuild your preprocessor or compiler which
might work around the problem.

>   namespace detail
>   {
>     template <class T> struct specifies_bases
>     {
>         static const bool value = false;
>     };
>     template <class 0, class B1, class B2, [...], class B14>
>     struct specifies_bases<bases<0, B1, B2, [...], B14> >
>     {
>         static const bool value = true;
>     };
>
>   [...]
> ---
>
> Obviously '0' isn't a valid typename, which is causing the error.  It
> seems as though bases.hpp exists in two different versions in CVS
> (with a different one under the mpl_v2 branch) but I'm not knowledgeable
> enough with CVS to work out which versions I need, or how to get them.

You don't need any branch versions of anything other than the
mpl-development branch of boost/mpl as specified in the message you linked
to.

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave at boost-consulting.com * http://www.boost-consulting.com





More information about the Cplusplus-sig mailing list