CaboCha の Python バインディングのインストールで下のエラーが出たときの対応法です。
python setup.py build running build running build_py running build_ext building '_CaboCha' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/local/include/python2.5 -c CaboCha_wrap.cxx -o build/temp.linux-x86_64-2.5/CaboCha_wrap.o cc1plus: 警告: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/backward/strstream:51 から include されたファイル中, /usr/local/include/cabocha.h:110 から, CaboCha_wrap.cxx:1464 から: /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/backward/backward_warning.h:32:2: 警告: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting theheader for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated. CaboCha_wrap.cxx: In function ‘int SWIG_Python_ConvertPtr(PyObject*, void**, swig_type_info*, int)’: CaboCha_wrap.cxx:1209: error: invalid conversion from ‘const char*’ to ‘char*’ CaboCha_wrap.cxx: In function ‘void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)’: CaboCha_wrap.cxx:3263: error: invalid conversion from ‘const char*’ to ‘char*’ error: command 'gcc' failed with exit status 1
cabocha-0.53/python/CaboCha_wrap.cxx を 3行ほど書き換えると幸せになれるかもしれません。
1209行目 修正前 char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); 修正後 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); 3263行目 修正前 char *c = methods[i].ml_doc; 修正後 const char *c = methods[i].ml_doc; 3267行目 修正前 char *name = c + 10; 修正後 const char *name = c + 10;
ではでは