在windows下使用过很多次coreseek了,但是还没在linux下安装过他,今天特意在Debian先安装体验了一把,过程如下:
下载mmseg
wget -O "mmseg-0.7.3.tar.gz" "http://www.coreseek.com/uploads/sources/mmseg-0.7.3.tar.gz"
下载coreseek1.5.2
wget -O "coreseek_fulltext_2.5.2.tar.gz" "http://www.coreseek.com/uploads/sources/coreseek_fulltext_2.5.2.tar.gz"
解压缩两个文件包
tar -xzvf mmseg-0.7.3.tar.gz
tar -xzvf coreseek_fulltext_2.5.2.tar.gz
编译mmseg
cd mmseg-0.7.3
./configure --prefix=/usr/local/mmseg
make
make install
编译coreseek
cd coreseek_fulltext_2.5.source/
到这里都一切正常;下面就开始麻烦了
第一configure
./configure --prefix=/usr/local/coreseek --with-python --with-mysql --with-mmseg-includes=/usr/local/mmseg/include/ --with-mmseg-libs=/usr/local/mmseg/lib/
make
结果提示错误
tokenizer_zhcn.cpp:1:30: error: SegmenterManager.h: No such file or directory
tokenizer_zhcn.cpp:2:23: error: Segmenter.h: No such file or directory
tokenizer_zhcn.cpp:15: error: expected initializer before '<' token
tokenizer_zhcn.cpp:43: error: 'css' has not been declared
tokenizer_zhcn.cpp:43: error: ISO C++ forbids declaration of 'Segmenter' with no type
tokenizer_zhcn.cpp:43: error: expected ';' before '*' token
tokenizer_zhcn.cpp:55: error: expected `;' before 'iconv_t'
tokenizer_zhcn.cpp:89: error: 'css' has not been declared
tokenizer_zhcn.cpp:89: error: ISO C++ forbids declaration of 'ToLowerImpl' with no type
tokenizer_zhcn.cpp:89: error: expected ';' before '*' token
tokenizer_zhcn.cpp:90: error: 'css' has not been declared
tokenizer_zhcn.cpp:90: error: ISO C++ forbids declaration of 'ChineseCharTaggerImpl' with no type
tokenizer_zhcn.cpp:90: error: expected ';' before '*' token
tokenizer_zhcn.cpp:92: error: 'css' has not been declared
tokenizer_zhcn.cpp:92: error: ISO C++ forbids declaration of 'Segmenter' with no type
tokenizer_zhcn.cpp:92: error: expected ';' before '*' token
tokenizer_zhcn.cpp:93: error: 'css' has not been declared
tokenizer_zhcn.cpp:93: error: ISO C++ forbids declaration of 'SegmenterManager' with no type
tokenizer_zhcn.cpp:93: error: expected ';' before '*' token
tokenizer_zhcn.cpp: In constructor 'CSphTokenizer_zh_CN_UTF8_Private::CSphTokenizer_zh_CN_UTF8_Private()':
tokenizer_zhcn.cpp:21: error: class 'CSphTokenizer_zh_CN_UTF8_Private' does not have any field named 'm_seg'
tokenizer_zhcn.cpp:21: error: class 'CSphTokenizer_zh_CN_UTF8_Private' does not have any field named 'm_mgr'
tokenizer_zhcn.cpp:26: error: 'm_lower' was not declared in this scope
tokenizer_zhcn.cpp:27: error: 'css' has not been declared
tokenizer_zhcn.cpp:28: error: 'm_tagger' was not declared in this scope
tokenizer_zhcn.cpp:29: error: 'css' has not been declared
tokenizer_zhcn.cpp: At global scope:
tokenizer_zhcn.cpp:100: error: 'css' has not been declared
tokenizer_zhcn.cpp:100: error: expected constructor, destructor, or type conversion before '*' token
tokenizer_zhcn.cpp:101: error: 'css' has not been declared
tokenizer_zhcn.cpp:101: error: expected constructor, destructor, or type conversion before '*' token
tokenizer_zhcn.cpp: In member function 'virtual void CSphTokenizer_zh_CN_UTF8::SetBuffer(BYTE*, int)':
tokenizer_zhcn.cpp:134: error: 'css' has not been declared
tokenizer_zhcn.cpp:134: error: 'seg' was not declared in this scope
tokenizer_zhcn.cpp:134: error: 'class CSphTokenizer_zh_CN_UTF8_Private' has no member named 'GetSegmenter'
tokenizer_zhcn.cpp:135: error: 'u1' was not declared in this scope
tokenizer_zhcn.cpp:135: error: expected primary-expression before ')' token
tokenizer_zhcn.cpp: In member function 'virtual BYTE* CSphTokenizer_zh_CN_UTF8::GetToken()':
tokenizer_zhcn.cpp:152: error: 'css' has not been declared
tokenizer_zhcn.cpp:152: error: 'seg' was not declared in this scope
tokenizer_zhcn.cpp:152: error: 'class CSphTokenizer_zh_CN_UTF8_Private' has no member named 'GetSegmenter'
tokenizer_zhcn.cpp:154: error: 'u2' was not declared in this scope
tokenizer_zhcn.cpp:154: error: expected `;' before 'len'
tokenizer_zhcn.cpp:158: error: 'len' was not declared in this scope
tokenizer_zhcn.cpp:158: error: 'symlen' was not declared in this scope
tokenizer_zhcn.cpp:162: error: 'len' was not declared in this scope
tokenizer_zhcn.cpp:167: error: 'symlen' was not declared in this scope
tokenizer_zhcn.cpp:180: error: 'class CSphTokenizer_zh_CN_UTF8_Private' has no member named 'm_lower'
tokenizer_zhcn.cpp:180: error: expected primary-expression before 'int'
tokenizer_zhcn.cpp:180: error: expected `)' before 'int'
tokenizer_zhcn.cpp:199: error: expected `;' before 'tag'
tokenizer_zhcn.cpp:200: error: 'tag' was not declared in this scope
经请教coreseek作者后发现,问题出在mmseg头文件包含不正确;
因此使用下面参数configure
./configure --prefix=/usr/local/coreseek --with-python --with-mysql --with-mmseg-includes=/usr/local/mmseg/include/mmseg --with-mmseg-libs=/usr/local/mmseg/lib/
结果还是报错,错误提示为:
In file included from pydatasource.cpp:13:
pydatasource.h:11:26: error: Python.h: No such file or directory
pydatasource.h:65: error: 'PyObject' has not been declared
pydatasource.h:67: error: ISO C++ forbids declaration of 'PyObject' with no type
pydatasource.h:67: error: expected ';' before '*' token
pydatasource.h:68: error: ISO C++ forbids declaration of 'PyObject' with no type
pydatasource.h:68: error: expected ';' before '*' token
pydatasource.h:69: error: ISO C++ forbids declaration of 'PyObject' with no type
pydatasource.h:69: error: expected ';' before '*' token
pydatasource.h:70: error: ISO C++ forbids declaration of 'PyObject' with no type
pydatasource.h:70: error: expected ';' before '*' token
pydatasource.cpp:17: error: 'PyObject' was not declared in this scope
pydatasource.cpp:17: error: 'pMain' was not declared in this scope
pydatasource.cpp:17: error: expected primary-expression before '&' token
pydatasource.cpp:17: error: 'datasource_list' was not declared in this scope
pydatasource.cpp:17: error: initializer expression list treated as compound expression
pydatasource.cpp: In constructor 'CSphSource_Python::CSphSource_Python(const char*)':
pydatasource.cpp:23: error: 'main_module' was not declared in this scope
pydatasource.cpp:24: error: 'builtin_module' was not declared in this scope
pydatasource.cpp:25: error: 'time_module' was not declared in this scope
pydatasource.cpp:26: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp: In destructor 'virtual CSphSource_Python::~CSphSource_Python()':
pydatasource.cpp:34: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:35: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp: In member function 'bool CSphSource_Python::Setup(const CSphConfigSection&, const char*)':
pydatasource.cpp:44: error: 'Py_IsInitialized' was not declared in this scope
pydatasource.cpp:45: error: 'Py_Initialize' was not declared in this scope
pydatasource.cpp:58: error: 'PyErr_Print' was not declared in this scope
pydatasource.cpp:59: error: 'PyErr_Clear' was not declared in this scope
pydatasource.cpp:63: error: 'main_module' was not declared in this scope
pydatasource.cpp:63: error: 'PyImport_AddModule' was not declared in this scope
pydatasource.cpp:64: error: 'builtin_module' was not declared in this scope
pydatasource.cpp:65: error: 'time_module' was not declared in this scope
pydatasource.cpp:73: error: 'FindDatasource' cannot be used as a function
pydatasource.cpp: In static member function 'static void CSphSource_Python::CleanUp()':
pydatasource.cpp:100: error: 'Py_IsInitialized' was not declared in this scope
pydatasource.cpp:106: error: 'Py_Finalize' was not declared in this scope
pydatasource.cpp: In member function 'virtual bool CSphSource_Python::Connect(CSphString&)':
pydatasource.cpp:121: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:128: error: 'PyObject' was not declared in this scope
pydatasource.cpp:128: error: 'pList' was not declared in this scope
pydatasource.cpp:128: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:128: error: 'PyObject_Dir' was not declared in this scope
pydatasource.cpp:131: error: 'PyErr_Print' was not declared in this scope
pydatasource.cpp:134: error: 'PyList_Check' was not declared in this scope
pydatasource.cpp:136: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:141: error: 'PyList_Size' was not declared in this scope
pydatasource.cpp:144: error: 'item' was not declared in this scope
pydatasource.cpp:144: error: 'PyList_GetItem' was not declared in this scope
pydatasource.cpp:145: error: 'item_str' was not declared in this scope
pydatasource.cpp:145: error: 'PyObject_Str' was not declared in this scope
pydatasource.cpp:147: error: 'PyString_AsString' was not declared in this scope
pydatasource.cpp:151: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:153: error: 'PyObject_GetAttrString' was not declared in this scope
pydatasource.cpp:160: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:165: error: 'PyErr_Clear' was not declared in this scope
pydatasource.cpp:170: error: 'item' was not declared in this scope
pydatasource.cpp:170: error: 'PyList_GetItem' was not declared in this scope
pydatasource.cpp:171: error: 'item_str' was not declared in this scope
pydatasource.cpp:171: error: 'PyObject_Str' was not declared in this scope
pydatasource.cpp:172: error: 'PyString_AsString' was not declared in this scope
pydatasource.cpp:173: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:181: error: 'PyObject_GetAttrString' was not declared in this scope
pydatasource.cpp:185: error: 'PyInt_Type' was not declared in this scope
pydatasource.cpp:188: error: 'PyErr_Clear' was not declared in this scope
pydatasource.cpp:196: error: 'PyMethod_Type' was not declared in this scope
pydatasource.cpp:200: error: 'PyFloat_Type' was not declared in this scope
pydatasource.cpp:207: error: 'PyInt_Type' was not declared in this scope
pydatasource.cpp:215: error: 'PyList_Type' was not declared in this scope
pydatasource.cpp:224: error: 'PyBool_Type' was not declared in this scope
pydatasource.cpp:231: error: 'PyString_Type' was not declared in this scope
pydatasource.cpp:237: error: 'timeFunc' was not declared in this scope
pydatasource.cpp:237: error: 'time_module' was not declared in this scope
pydatasource.cpp:255: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:261: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:263: error: 'PyErr_Print' was not declared in this scope
pydatasource.cpp:266: error: 'PyObject' was not declared in this scope
pydatasource.cpp:266: error: 'pArgs' was not declared in this scope
pydatasource.cpp:267: error: 'pResult' was not declared in this scope
pydatasource.cpp:268: error: 'pFunc' was not declared in this scope
pydatasource.cpp:268: error: 'PyObject_GetAttrString' was not declared in this scope
pydatasource.cpp:271: error: 'PyErr_Clear' was not declared in this scope
pydatasource.cpp:275: error: 'PyCallable_Check' was not declared in this scope
pydatasource.cpp:276: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:279: error: 'Py_BuildValue' was not declared in this scope
pydatasource.cpp:281: error: 'PyEval_CallObject' was not declared in this scope
pydatasource.cpp:282: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp: At global scope:
pydatasource.cpp:294: error: 'bool CSphSource_Python::CheckResult' is not a static member of 'class CSphSource_Python'
pydatasource.cpp:294: error: 'PyObject' was not declared in this scope
pydatasource.cpp:294: error: 'pResult' was not declared in this scope
pydatasource.cpp:295: error: expected ',' or ';' before '{' token
pydatasource.cpp: In member function 'virtual void CSphSource_Python::PostIndex()':
pydatasource.cpp:322: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:324: error: 'PyErr_Print' was not declared in this scope
pydatasource.cpp:327: error: 'PyObject' was not declared in this scope
pydatasource.cpp:327: error: 'pArgs' was not declared in this scope
pydatasource.cpp:328: error: 'pResult' was not declared in this scope
pydatasource.cpp:329: error: 'pFunc' was not declared in this scope
pydatasource.cpp:329: error: 'PyObject_GetAttrString' was not declared in this scope
pydatasource.cpp:331: error: 'PyErr_Clear' was not declared in this scope
pydatasource.cpp:333: error: 'PyCallable_Check' was not declared in this scope
pydatasource.cpp:334: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:337: error: 'Py_BuildValue' was not declared in this scope
pydatasource.cpp:339: error: 'PyEval_CallObject' was not declared in this scope
pydatasource.cpp:340: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp: In member function 'virtual bool CSphSource_Python::IterateHitsStart(CSphString&)':
pydatasource.cpp:353: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:355: error: 'PyErr_Print' was not declared in this scope
pydatasource.cpp:358: error: 'PyObject' was not declared in this scope
pydatasource.cpp:358: error: 'pArgs' was not declared in this scope
pydatasource.cpp:359: error: 'pResult' was not declared in this scope
pydatasource.cpp:360: error: 'pFunc' was not declared in this scope
pydatasource.cpp:360: error: 'PyObject_GetAttrString' was not declared in this scope
pydatasource.cpp:362: error: 'PyErr_Clear' was not declared in this scope
pydatasource.cpp:364: error: 'PyCallable_Check' was not declared in this scope
pydatasource.cpp:365: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:368: error: 'Py_BuildValue' was not declared in this scope
pydatasource.cpp:370: error: 'PyEval_CallObject' was not declared in this scope
pydatasource.cpp:371: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp: In member function 'virtual BYTE** CSphSource_Python::NextDocument(CSphString&)':
pydatasource.cpp:448: error: 'm_pInstance' was not declared in this scope
pydatasource.cpp:450: error: 'PyErr_Print' was not declared in this scope
pydatasource.cpp:453: error: 'PyObject' was not declared in this scope
pydatasource.cpp:453: error: 'pArgs' was not declared in this scope
pydatasource.cpp:454: error: 'pResult' was not declared in this scope
pydatasource.cpp:455: error: 'pFunc' was not declared in this scope
pydatasource.cpp:455: error: 'PyObject_GetAttrString' was not declared in this scope
pydatasource.cpp:459: error: 'PyCallable_Check' was not declared in this scope
pydatasource.cpp:460: error: 'Py_XDECREF' was not declared in this scope
pydatasource.cpp:463: error: 'Py_BuildValue' was not declared in this scope
pydatasource.cpp:465: error: 'PyEval_CallObject' was not declared in this scope
pydatasource.cpp:466: error: 'Py_XDECRE
检查发现无python-dev包;安装此包
apt-get install python-dev
继续编译coreseek
./configure --prefix=/usr/local/coreseek --with-python --with-mysql --with-mmseg-includes=/usr/local/mmseg/include/mmseg --with-mmseg-libs=/usr/local/mmseg/lib/
make
make install
一个小心得,如果make文件失败后更改configure参数后继续make出错可以尝试下make clean;清除掉之前的make的文件再次make。