chokkan / crfsuite

CRFsuite: a fast implementation of Conditional Random Fields (CRFs)
http://www.chokkan.org/software/crfsuite/
Other
641 stars 208 forks source link

python setup.py build_ext error #95

Open pjpan opened 6 years ago

pjpan commented 6 years ago

env: linux-centos 6.5 swig:1.3.40 python: 3.6 (anaconda)

when command python setup.py build_ext,raise error. How to fix it

here is details: [bankdplyop@CNSZ446042 python]$ python setup.py build_ext --include-dir=/bankapp/bankdplyop/packages/crfsuite/include --library-dirs=/bankapp/bankdplyop/packages/crfsuite/lib running build_ext building '_crfsuite' extension g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/bankapp/bankdplyop/packages/crfsuite/include -I/bankapp/bankdplyop/anaconda3/include/python3.6m -c crfsuite.cpp -o build/temp.linux-x86_64-3.6/crfsuite.o cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/bankapp/bankdplyop/packages/crfsuite/include -I/bankapp/bankdplyop/anaconda3/include/python3.6m -c export_wrap.cpp -o build/temp.linux-x86_64-3.6/export_wrap.o cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ export_wrap.cpp: In function ‘swig_module_info SWIG_Python_GetModule()’: export_wrap.cpp:2453: error: ‘PyCObject_Import’ was not declared in this scope export_wrap.cpp: In function ‘void SWIG_Python_SetModule(swig_module_info)’: export_wrap.cpp:2522: error: ‘PyCObject_FromVoidPtr’ was not declared in this scope export_wrap.cpp:2513: warning: unused variable ‘swig_empty_runtime_method_table’ export_wrap.cpp: In function ‘swig_type_info SWIG_Python_TypeQuery(const char)’: export_wrap.cpp:2545: error: ‘PyCObject_AsVoidPtr’ was not declared in this scope export_wrap.cpp:2550: error: ‘PyCObject_FromVoidPtr’ was not declared in this scope export_wrap.cpp: In function ‘std::vector<CRFSuite::Attribute, std::allocator > std_vector_Sl_CRFSuite_Attribute_SggetitemSWIG_0(std::vector<CRFSuite::Attribute, std::allocator >, PySliceObject)’: export_wrap.cpp:4695: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘void std_vector_Sl_CRFSuite_Attribute_SgsetitemSWIG_0(std::vector<CRFSuite::Attribute, std::allocator >, PySliceObject, const std::vector<CRFSuite::Attribute, std::allocator >&)’: export_wrap.cpp:4704: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘void std_vector_Sl_CRFSuite_Attribute_SgdelitemSWIG_1(std::vector<CRFSuite::Attribute, std::allocator >, PySliceObject)’: export_wrap.cpp:4713: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: At global scope: export_wrap.cpp:4727: error: redefinition of ‘struct swig::traits<std::vector<CRFSuite::Attribute, std::allocator > >’ export_wrap.cpp:4635: error: previous definition of ‘struct swig::traits<std::vector<CRFSuite::Attribute, std::allocator > >’ export_wrap.cpp: In function ‘std::vector<std::vector<CRFSuite::Attribute, std::allocator >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator > > > std_vector_Sl_CRFSuite_Item_SggetitemSWIG_0(std::vector<std::vector<CRFSuite::Attribute, std::allocator >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator > > >, PySliceObject)’: export_wrap.cpp:4780: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘void std_vector_Sl_CRFSuite_Item_SgsetitemSWIG_0(std::vector<std::vector<CRFSuite::Attribute, std::allocator >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator > > >, PySliceObject, const std::vector<std::vector<CRFSuite::Attribute, std::allocator >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator > > >&)’: export_wrap.cpp:4789: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘void std_vector_Sl_CRFSuite_Item_SgdelitemSWIG_1(std::vector<std::vector<CRFSuite::Attribute, std::allocator >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator > > >, PySliceObject)’: export_wrap.cpp:4798: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > std_vector_Sl_std_string_SggetitemSWIG_0(std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > >, PySliceObject)’: export_wrap.cpp:5047: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘void std_vector_Sl_std_string_SgsetitemSWIG_0(std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > >, PySliceObject, const std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > >&)’: export_wrap.cpp:5056: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t)’ export_wrap.cpp: In function ‘void std_vector_Sl_std_string_SgdelitemSWIG_1(std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > >, PySliceObject)’: export_wrap.cpp:5065: error: cannot convert ‘PySliceObject’ to ‘PyObject’ for argument ‘1’ to ‘int PySlice_GetIndices(PyObject, Py_ssize_t, Py_ssize_t, Py_ssize_t, Py_ssize_t*)’ error: command 'g++' failed with exit status 1