CXX extension question.

Iwan Cao liwen at eefind.com
Mon Jun 25 01:34:36 EDT 2001


Greetings,

I'm building a Python extension module using CXX. Everything looks just
fine. This is my setup.py for my module PyHtmlText:

import os, sys
from distutils.core import setup, Extension
support_dir = os.path.join(sys.prefix, "etc", "CXX")
htmltext_dir= ".."

platform= 'UNKNOWN'
if sys.platform[:5]== 'win32':
 platform= 'WIN32'

if sys.platform[:5]== 'linux':
 platform= 'LINUX'

setup (name = "PyHtmlText",
       version = "0.1",
       maintainer = "Lilly Bai",
       maintainer_email = "baili at cn.ibm.com",
       description = "A wrapper for HTML page analyzer",
       url = "http://www.ibm.com.cn",

       packages = ['PyHtmlText'],
       package_dir = {'PyHtmlText': '.'},
       ext_modules = [
         Extension('PyHtmlText.pyhtmltext',
                   define_macros= [(platform, None),
('HTMLANALYZER_DLL_API', '')],
       include_dirs= [(htmltext_dir)],
                   sources = ['pyhtmltext.cpp',
                              os.path.join(htmltext_dir, 'TextBlock.cpp'),
                              os.path.join(htmltext_dir,
'HtmlAnalyzer.cpp'),
                              os.path.join(htmltext_dir,
'HtmlExtractor.cpp'),
                              os.path.join(htmltext_dir, 'PageData.cpp'),

                              os.path.join(support_dir,'cxxsupport.cxx'),

os.path.join(support_dir,'cxx_extensions.cxx'),
                              os.path.join(support_dir,'cxxextensions.c'),
                            ],
            )
       ]
)

I build the module on Linux and Windows2000, and it works on Windows2000.
However, when I import the module on Linux,
python report: ImportError: ./pyhtmltext.so: undefined symbol:
what__C13runtime_error

I guess it may because there is a statement in my code:
try{
...
}
catch(HtmlPageError &err){
  std::cerr<< "HtmlAnalyzer Exception: "<< a_sFileName<< "\t"<< err.what()<<
std::endl;
  throw RuntimeError(err.what());
}

But when I comment out that code, there is still error.
Any hint on that?

Thanks in advance!

BR
Iwan





More information about the Python-list mailing list