[C++-sig] Re: Cross module inheritance failing with the Intel compiler on Linux

David Abrahams dave at boost-consulting.com
Thu Mar 11 15:09:50 CET 2004

"J. Michael Owen" <mikeowen at llnl.gov> writes:

> I'm trying to use the Intel C++ complier (7.0) on Linux with Boost.Python
> (latest release, 1.31.0), but running into problems with cross module
> inheritance.  At the end of this message I've appended a stripped down example
> of the problem in 4 files: A.hh, B.hh, A.cc, and B.cc.  A.hh defines a base
> class "Base", while B.hh defines a class "Derived" which inherits publicly from
> "Base".  I compile these into two separate modules (A.cc -> A.so, B.cc -> B.so),
> and then fire up python and execute the following:
>>>> import A
>>>> import B
> If I build everything with g++ all is fine and I can use the "Derived" class in
> python.  However, if I build with Intel's icc (both Boost.Python and this
> example code of course) everything compiles, but I get the following run time
> error:
>>>> import A
>>>> import B
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> RuntimeError: extension class wrapper for base class 4Base has not been created yet
> Are other folks successfully using Intel icc with Boost.Python?  Does anyone
> have any suggestions how I could correct this problem?

Here's the story:

I don't know about Intel 7.0.

In the latest release, we added the <stdlib> feature to Boost.Build in
order to allow us to use Intel 8.x with the GCC standard library
(-cxxlib-gcc ICC command-line option).  This was unfortunately needed
in order to get extensions built with Intel 8.x to work with a stock
(GCC-built) Python on Linux.  Unfortunately, the -cxxlib-gcc feature
is broken in Intel 7.1, so the strategem fails.

If you want to use a Python built with the Intel compiler, you should
use a Boost.Python library built with <stdlib>default instead of
<stdlib>gcc in your bjam BUILD variable.

I *think* that'll work with Intel 7.x, but I can't promise.

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list