[C++-sig] Big error in GCCXML compilation :: segmentation fault termination

Stéphane Barranx sbarranx at modulonet.fr
Wed Apr 12 15:59:47 CEST 2006


Hi, I'm trying to wrap a C++ project for motion correction. Like
in tutorials, I made the environment and py++ run scripts. But
when I try to run the script, I got tons of error but obviously
only two major problems. Here is the beginning of the error
log:

Traceback (most recent call last):
  File "D:\MotionCorrection\Foundation\wrap\pypp_Foundation.py",
line 112, in ?
    export()
  File "D:\MotionCorrection\Foundation\wrap\pypp_Foundation.py",
line 107, in export
    exporter.create()
  File "D:\MotionCorrection\Foundation\wrap\pypp_Foundation.py",
line 98, in create
    decls = self.read_declarations()
  File "D:\MotionCorrection\Foundation\wrap\pypp_Foundation.py",
line 65, in read_declarations
    return reader.read_files( self.__header_files )
  File "C:\Program
Files\Python24\Lib\site-packages\pygccxml\parser\project_reader.py",
line 61, in read_files
    return self.__parse_file_by_file(files)
  File "C:\Program
Files\Python24\Lib\site-packages\pygccxml\parser\project_reader.py",
line 82, in __parse_file_by_file
    decls = reader.read_file( header )
  File "C:\Program
Files\Python24\Lib\site-packages\pygccxml\parser\source_reader.py",
line 140, in read_file
    raise error
gccxml_runtime_error_t: Error occured while running GCC-XML: In
file included from
D:/MotionCorrection/Foundation/VectorField.h:24,
                 from D:/MotionCorrection/Foundation/Image.h:23:
D:/MotionCorrection/Foundation/Matrix.h: In constructor `
   Xform2DParams::Xform2DParams(int)':
D:/MotionCorrection/Foundation/Matrix.h:40: error: `fill_n' 
   undeclared in namespace `std'
D:/MotionCorrection/Foundation/Matrix.h: In copy constructor `
   Xform2DParams::Xform2DParams(const Xform2DParams&)':
D:/MotionCorrection/Foundation/Matrix.h:46: error: `copy' 
   undeclared in namespace `std'

//** ?? 'fill_n' and 'copy' are actually members of the standard
library **//

In file included from
D:/MotionCorrection/Foundation/VectorField.h:28,
                 from D:/MotionCorrection/Foundation/Image.h:23:
C:/Program Files/Microsoft Visual Studio .NET
2003/Vc7/Include/valarray: At global scope:
C:/Program Files/Microsoft Visual Studio .NET
2003/Vc7/Include/valarray:30: error: `
   size_t' was not declared in this scope
C:/Program Files/Microsoft Visual Studio .NET
2003/Vc7/Include/valarray:30: error: template
   argument 1 is invalid

//** I stop here but there is hundreds of errors next but only in
'valarray' **//

So, can anybody help me? 

Here is my run script:


import os, time
from environment import settings
from pygccxml import parser
from pygccxml import declarations
from pyplusplus import code_creators
from pyplusplus import module_creator
from pyplusplus import file_writers

def full_path(path, file):
    return os.path.join( path, file )  

def identify_call_policies( decl ):
    build_in_resolver = module_creator.build_in_resolver_t()
    policy = build_in_resolver( decl )
    if policy:
        return policy

    if isinstance( decl, declarations.member_operator_t ) \
       and decl.symbol == '()' \
       and decl.parent.name == 'Foundation':
        return code_creators.return_internal_reference()
    return None

class Foundation_exporter_t:
    def __init__(self):
        path = settings.Foundation_path
        self.__header_files = []
        self.__header_files.append(full_path(path,
'Foundation.h'))
        self.__header_files.append(full_path(path, 'Image.h'))
        self.__header_files.append(full_path(path,
'LSPoly2Approx.h'))
        self.__header_files.append(full_path(path, 'Mask.h'))
        self.__header_files.append(full_path(path, 'Matrix.h'))
        self.__header_files.append(full_path(path,
'Polynomial1.h'))
        self.__header_files.append(full_path(path,
'Polynomial2.h'))
        self.__header_files.append(full_path(path, 'RecPar.h'))
        self.__header_files.append(full_path(path,
'SOUnwrapper.h'))
        self.__header_files.append(full_path(path,
'TUnwrapper.h'))
        self.__header_files.append(full_path(path, 'Vector2.h'))
        self.__header_files.append(full_path(path,
'VectorField.h'))
        self.__header_files.append(full_path(path,
'WLSPoly2Approx.h'))
    
    def read_declarations(self):
        config = parser.config_t(
gccxml_path=settings.gccxml_path
                                  ,
working_directory=settings.MotionCorrection_path
                                  ,
include_paths=settings.vtk_paths)
        reader = parser.project_reader_t( config )
        return reader.read_files( self.__header_files )
    
    def filter_declarations(self, decls ):
        return declarations.filtering.by_location( decls,
[settings.MotionCorrection_path] )
    
    def create_extmodule(self, decls):
        creator = module_creator.creator_t( decls=decls
                                            ,
module_name=settings.Foundation.module_name
                                            ,
create_castinig_constructor=True
                                            ,
call_policies_resolver_=identify_call_policies) 
        return creator.create()
    
    def customize_extmodule( self, extmodule ):
        global license
        extmodule.license = license
        extmodule.std_directories.append( settings.boost_path )
        extmodule.std_directories.extend( settings.vtk_paths )
        #butifying include code generation
        extmodule.user_defined_directories.append(
settings.MotionCorrection_path )
        extmodule.user_defined_directories.append(
settings.Foundation_path )
        extmodule.user_defined_directories.append(
settings.working_dir )
        extmodule.user_defined_directories.extend(
config.include_paths )
        extmodule.precompiled_header = 'boost/python.hpp'
        #Adding headers as first includes. It comes because of
internal structure of Foundation
        extmodule.adopt_creator( code_creators.include_t(
header=self.__header_files ), 2 )
        #body_index = extmodule.creators.index( extmodule.body )
        
    def write_files( self, extmodule ):
        file_writers.write_file(extmodule
                                ,
os.path.join(settings.Foundation.generated_files_dir
                                               ,
settings.Foundation.module_name + '.cpp') )

    def create(self):
        decls = self.read_declarations()
        self.filter_declarations(decls)
        extmodule = self.create_extmodule( decls )
        self.customize_extmodule( extmodule )
        self.write_files( extmodule )

def export():
    start = time.clock()
    exporter = Foundation_exporter_t()
    exporter.create()
    finish = time.clock() - start
    print '%0.2f seconds' % finish

if __name__ == '__main__':
    export()
    print 'done'

//** end of the script **//

Where is my mistake?? Did I forgot an inclusion? Why the GCCXML
compiler doesn't recognize 'fill_n' and 'copy'? What's wrong
with 'valarray' file?

Thanks for helping





More information about the Cplusplus-sig mailing list