[C++-sig] newbie question: name mangling issue

Andrew Straw strawman at astraw.com
Fri Jul 2 08:00:45 CEST 2004


Hi,

I'm a Boost(.Python) newbie and have long since forgotten most C++. 
However, trying to wrap a few bits of the opencv library, I'm getting a 
strange issue beyond my capabilities, and it seemingly involves name 
mangling.  Here's the error:

computer$ LD_LIBRARY_PATH="/usr/local/lib" python -c "import cvaux"
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: ./cvaux.so: undefined symbol: _ZTI13CvCalibFilter

"cvaux" is the name of the module I'm creating with Boost.Python. Here's 
the source, boost_cvaux.cpp:

#--------------------------------------------------
#include <cvaux.h>

#include <boost/python.hpp>
using namespace boost::python;

class CvCalibFilterWrap : public CvCalibFilter
{
public:
  CvCalibFilterWrap(PyObject* self_)
    : self(self_) {}
private:
  PyObject* self;
};

BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(CvCalibFilter_Stop_overloads, 
CvCalibFilter::Stop, 0, 1)

BOOST_PYTHON_MODULE(cvaux)
{
  class_<CvCalibFilter, CvCalibFilterWrap, 
boost::noncopyable>("CvCalibFilter",
                                   "This is CvCalibFilter's docstring")
    .def("SetCameraCount", &CvCalibFilter::SetCameraCount)
    .def("GetCameraCount", &CvCalibFilter::GetCameraCount)
    .def("SetFrames", &CvCalibFilter::SetFrames)
    .def("Stop", &CvCalibFilter::Stop,
     CvCalibFilter_Stop_overloads(args(false), "Stop's docstring")
     [return_internal_reference<>()])
    ;
}
#--------------------------------------------------

Here's the relevant bit from cvaux.h:


#--------------------------------------------------
class CVAUX_DLL_ENTRY CvCalibFilter
{
public:
    /* Constructor & destructor */
    CvCalibFilter();
    virtual ~CvCalibFilter();
    /* (snipped) */
}
#--------------------------------------------------

Here's a few lines from "strings /usr/local/lib/libcvaux.so | grep 
CvCalibFilter":
_ZTV13CvCalibFilter
_ZN13CvCalibFilterD1Ev
_ZN13CvCalibFilterD0Ev

So, it seems that an identifier very close to the unresolved 
"_ZTI13CvCalibFilter" is in the .so, but it is not quite exactly the same.

I've recently re-complied opencv from source just to be sure I'm using 
the same version of gcc/g++ (3.3.4 Debian), and I still get the same error.

Finally, here's my Jamfile:
#--------------------------------------------------
# This is the top of our own project tree
project-root ;

#   Include definitions needed for Python modules
import python ;

extension cvaux                     # Declare a Python extension
: # sources
    boost_cvaux.cpp
: # requirements
    <sysinclude>/usr/local/include/opencv
        <find-library>opencv
        <find-library>cvaux
        <find-library>boost_python
  ;
#--------------------------------------------------


I've tried to follow the examples.  Am I doing something wrong?  How can 
I fix this?

TIA+Cheers!
Andrew




More information about the Cplusplus-sig mailing list