jaiminpan / pg_jieba

Postgresql full-text search extension for chinese
BSD 3-Clause "New" or "Revised" License
338 stars 65 forks source link

make error #23

Closed linmanpeng closed 6 years ago

linmanpeng commented 6 years ago

centos7.0 gcc4.8.5 postgresql9.6.3 make error

[100%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o /root/0303/pg_jieba/pg_jieba.cpp: In constructor ‘pg_jieba::PgJieba::PgJieba(const string&, const string&, const string&)’: /root/0303/pg_jieba/pg_jieba.cpp:204:10: error: ‘num_types’ does not name a type auto num_types = sizeof(tok_alias) / sizeof(tok_alias[0]); ^ /root/0303/pg_jieba/pg_jieba.cpp:205:15: error: ‘i’ does not name a type for (auto i = 1; i < num_types; ++i) { ^ /root/0303/pg_jieba/pg_jieba.cpp:205:22: error: expected ‘;’ before ‘i’ for (auto i = 1; i < num_types; ++i) { ^ /root/0303/pg_jieba/pg_jieba.cpp:205:22: error: ‘i’ was not declared in this scope /root/0303/pg_jieba/pg_jieba.cpp:205:26: error: ‘num_types’ was not declared in this scope for (auto i = 1; i < num_types; ++i) { ^ /root/0303/pg_jieba/pg_jieba.cpp:206:21: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default] lexid.insert({tok_alias[i], i}); ^ /root/0303/pg_jieba/pg_jieba.cpp:206:39: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default] lexid.insert({tok_alias[i], i}); ^ /root/0303/pg_jieba/pg_jieba.cpp:206:39: error: no matching function for call to ‘std::tr1::unordered_map<std::basic_string, int>::insert()’ /root/0303/pg_jieba/pg_jieba.cpp:206:39: note: candidates are: In file included from /usr/include/c++/4.8.2/tr1/unordered_map:41:0, from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:16, from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/tr1/hashtable.h:374:7: note: std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::_Insert_Return_Type std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, __unique_keys>::insert(const value_type&) [with _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::detail::_Mod_range_hashing; _Hash = std::tr1::detail::_Default_ranged_hash; _RehashPolicy = std::tr1::detail::_Prime_rehash_policy; bool cache_hash_code = false; bool constant_iterators = false; bool unique_keys = true; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::_Insert_Return_Type = std::pair<std::tr1::detail::_Hashtable_iterator<std::pair<const std::basic_string, int>, false, false>, bool>; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::value_type = std::pair<const std::basic_string, int>] insert(const value_type& v) ^ /usr/include/c++/4.8.2/tr1/hashtable.h:374:7: note: no known conversion for argument 1 from ‘’ to ‘const value_type& {aka const std::pair<const std::basic_string, int>&}’ /usr/include/c++/4.8.2/tr1/hashtable.h:379:7: note: std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, __unique_keys>::iterator std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, __unique_keys>::insert(std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, __unique_keys>::iterator, const value_type&) [with _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::detail::_Mod_range_hashing; _Hash = std::tr1::detail::_Default_ranged_hash; _RehashPolicy = std::tr1::detail::_Prime_rehash_policy; bool cache_hash_code = false; bool constant_iterators = false; bool unique_keys = true; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::iterator = std::tr1::detail::_Hashtable_iterator<std::pair<const std::basic_string, int>, false, false>; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::value_type = std::pair<const std::basic_string, int>] insert(iterator, const value_type& v) ^ /usr/include/c++/4.8.2/tr1/hashtable.h:379:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8.2/tr1/hashtable.h:383:7: note: std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::const_iterator std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, __constant_iterators, unique_keys>::insert(std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::const_iterator, const value_type&) [with _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::detail::_Mod_range_hashing; _Hash = std::tr1::detail::_Default_ranged_hash; _RehashPolicy = std::tr1::detail::_Prime_rehash_policy; bool cache_hash_code = false; bool constant_iterators = false; bool unique_keys = true; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::const_iterator = std::tr1::detail::_Hashtable_const_iterator<std::pair<const std::basic_string, int>, false, false>; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, __unique_keys>::value_type = std::pair<const std::basic_string, int>] insert(const_iterator, const value_type& v) ^ /usr/include/c++/4.8.2/tr1/hashtable.h:383:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8.2/tr1/hashtable.h:388:2: note: template void std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, cache_hash_code, constant_iterators, unique_keys>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::detail::_Mod_range_hashing; _Hash = std::tr1::detail::_Default_ranged_hash; _RehashPolicy = std::tr1::detail::_Prime_rehash_policy; bool cache_hash_code = false; bool constant_iterators = false; bool unique_keys = true] insert(_InputIterator first, _InputIterator last); ^ /usr/include/c++/4.8.2/tr1/hashtable.h:388:2: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:206:39: note: candidate expects 2 arguments, 1 provided lexid.insert({tok_alias[i], i}); ^ /root/0303/pg_jieba/pg_jieba.cpp: In member function ‘int pg_jieba::PgJieba::LookupLexTypeId(const string&) const’: /root/0303/pg_jieba/pg_jieba.cpp:230:22: error: ‘const class std::tr1::unordered_map<std::basic_string, int>’ has no member named ‘at’ return lexid.at(this->LookupTag(str)); ^ /root/0303/pg_jieba/pg_jieba.cpp:232:22: error: ‘const class std::tr1::unordered_map<std::basic_string, int>’ has no member named ‘at’ return lexid.at("n"); ^ /root/0303/pg_jieba/pg_jieba.cpp: At global scope: /root/0303/pg_jieba/pg_jieba.cpp:250:25: error: ‘nullptr’ was not declared in this scope static PgJieba jieba = nullptr; ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘void pg_jieba::_PG_init()’: /root/0303/pg_jieba/pg_jieba.cpp:263:16: error: ‘nullptr’ was not declared in this scope if (jieba != nullptr) { ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘void pg_jieba::_PG_fini()’: /root/0303/pg_jieba/pg_jieba.cpp:280:16: error: ‘nullptr’ was not declared in this scope if (jieba != nullptr) { ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_start(FunctionCallInfo)’: /root/0303/pg_jieba/pg_jieba.cpp:293:8: error: ‘words’ does not name a type auto words = new vector(); ^ /root/0303/pg_jieba/pg_jieba.cpp:294:20: error: ‘words’ was not declared in this scope jieba->Cut(str, words); ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_query_start(FunctionCallInfo)’: /root/0303/pg_jieba/pg_jieba.cpp:306:8: error: ‘words’ does not name a type auto words = new vector(); ^ /root/0303/pg_jieba/pg_jieba.cpp:307:29: error: ‘words’ was not declared in this scope jieba->CutForSearch(str, *words); ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_gettoken(FunctionCallInfo)’: /root/0303/pg_jieba/pg_jieba.cpp:322:9: error: ISO C++ forbids declaration of ‘cur_iter’ with no type [-fpermissive] auto& cur_iter = ctx->iter; ^ /root/0303/pg_jieba/pg_jieba.cpp:322:25: error: invalid initialization of reference of type ‘int&’ from expression of type ‘std::vector<std::basic_string >::iterator {aka gnu_cxx::normal_iterator<std::basic_string*, std::vector<std::basic_string > >}’ auto& cur_iter = ctx->iter; ^ /root/0303/pg_jieba/pg_jieba.cpp:325:16: error: no match for ‘operator==’ (operand types are ‘int’ and ‘std::vector<std::basic_string >::iterator {aka __gnu_cxx::normal_iterator<std::basic_string, std::vector<std::basic_string > >}’) if (cur_iter == ctx->words->end()) { ^ /root/0303/pg_jieba/pg_jieba.cpp:325:16: note: candidates are: In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8.2/bits/char_traits.h:39, from /usr/include/c++/4.8.2/string:40, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/stl_pair.h:214:5: note: template<class _T1, class _T2> bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator==(const pair<_T1, _T2>& x, const pair<_T1, _T2>& y) ^ /usr/include/c++/4.8.2/bits/stl_pair.h:214:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::pair<_T1, _T2>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8.2/bits/char_traits.h:39, from /usr/include/c++/4.8.2/string:40, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/stl_iterator.h:291:5: note: template bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator==(const reverse_iterator<_Iterator>& x, ^ /usr/include/c++/4.8.2/bits/stl_iterator.h:291:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8.2/bits/char_traits.h:39, from /usr/include/c++/4.8.2/string:40, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/stl_iterator.h:341:5: note: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator==(const reverse_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8.2/bits/stl_iterator.h:341:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/bits/char_traits.h:40:0, from /usr/include/c++/4.8.2/string:40, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/postypes.h:216:5: note: template bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&) operator==(const fpos<_StateT>& lhs, const fpos<_StateT>& rhs) ^ /usr/include/c++/4.8.2/bits/postypes.h:216:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::fpos<_StateT>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/string:41:0, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/allocator.h:128:5: note: template<class _T1, class _T2> bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_T2>&) operator==(const allocator<_T1>&, const allocator<_T2>&) ^ /usr/include/c++/4.8.2/bits/allocator.h:128:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::allocator<_CharT>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/string:41:0, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/allocator.h:133:5: note: template bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_CharT>&) operator==(const allocator<_Tp>&, const allocator<_Tp>&) ^ /usr/include/c++/4.8.2/bits/allocator.h:133:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::allocator<_CharT>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/string:52:0, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/basic_string.h:2486:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator==(const basic_string<_CharT, _Traits, _Alloc>& lhs, ^ /usr/include/c++/4.8.2/bits/basic_string.h:2486:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/string:52:0, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/basic_string.h:2493:5: note: template typename gnu_cxx::enable_if<std::is_char<_Tp>::value, bool>::type std::operator==(const std::basic_string<_CharT>&, const std::basic_string<_CharT>&) operator==(const basic_string<_CharT>& lhs, ^ /usr/include/c++/4.8.2/bits/basic_string.h:2493:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::basic_string<_CharT>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/string:52:0, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/basic_string.h:2507:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT, const std::basic_string<_CharT, _Traits, _Alloc>&) operator==(const _CharT __lhs, ^ /usr/include/c++/4.8.2/bits/basic_string.h:2507:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const _CharT’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/string:52:0, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/basic_string.h:2519:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator==(const basic_string<_CharT, _Traits, _Alloc>& lhs, ^ /usr/include/c++/4.8.2/bits/basic_string.h:2519:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/vector:64:0, from /root/0303/pg_jieba/pg_jieba.cpp:15: /usr/include/c++/4.8.2/bits/stl_vector.h:1404:5: note: template<class _Tp, class _Alloc> bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator==(const vector<_Tp, _Alloc>& x, const vector<_Tp, _Alloc>& y) ^ /usr/include/c++/4.8.2/bits/stl_vector.h:1404:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::vector<_Tp, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/set:60:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_tree.h:310:5: note: template bool std::operator==(const std::_Rb_tree_iterator<_Tp>&, const std::_Rb_tree_const_iterator<_Val>&) operator==(const _Rb_tree_iterator<_Val>& x, ^ /usr/include/c++/4.8.2/bits/stl_tree.h:310:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Rb_tree_iterator<_Tp>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/set:60:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_tree.h:907:5: note: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator==(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&) operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& x, ^ /usr/include/c++/4.8.2/bits/stl_tree.h:907:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/set:61:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_set.h:754:5: note: template<class _Key, class _Compare, class _Alloc> bool std::operator==(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&) operator==(const set<_Key, _Compare, _Alloc>& x, ^ /usr/include/c++/4.8.2/bits/stl_set.h:754:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::set<_Key, _Compare, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/set:62:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_multiset.h:739:5: note: template<class _Key, class _Compare, class _Alloc> bool std::operator==(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&) operator==(const multiset<_Key, _Compare, _Alloc>& x, ^ /usr/include/c++/4.8.2/bits/stl_multiset.h:739:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::multiset<_Key, _Compare, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/bits/locale_facets.h:48:0, from /usr/include/c++/4.8.2/bits/basic_ios.h:37, from /usr/include/c++/4.8.2/ios:44, from /usr/include/c++/4.8.2/istream:38, from /usr/include/c++/4.8.2/sstream:38, from /root/0303/pg_jieba/libjieba/deps/limonp/Logging.hpp:4, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:7, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/streambuf_iterator.h:204:5: note: template<class _CharT, class _Traits> bool std::operator==(const std::istreambuf_iterator<_CharT, _Traits>&, const std::istreambuf_iterator<_CharT, _Traits>&) operator==(const istreambuf_iterator<_CharT, _Traits>& a, ^ /usr/include/c++/4.8.2/bits/streambuf_iterator.h:204:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::istreambuf_iterator<_CharT, _Traits>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/map:61:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:6, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_map.h:962:5: note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator==(const std::map<_Key, _Tp, _Compare, _Alloc>&, const std::map<_Key, _Tp, _Compare, _Alloc>&) operator==(const map<_Key, _Tp, _Compare, _Alloc>& x, ^ /usr/include/c++/4.8.2/bits/stl_map.h:962:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::map<_Key, _Tp, _Compare, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/map:62:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:6, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_multimap.h:864:5: note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator==(const std::multimap<_Key, _Tp, _Compare, _Alloc>&, const std::multimap<_Key, _Tp, _Compare, _Alloc>&) operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& x, ^ /usr/include/c++/4.8.2/bits/stl_multimap.h:864:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::multimap<_Key, _Tp, _Compare, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/iterator:66:0, from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:22, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stream_iterator.h:130:5: note: template<class _Tp, class _CharT, class _Traits, class _Dist> bool std::operator==(const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>&, const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>&) operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& x, ^ /usr/include/c++/4.8.2/bits/stream_iterator.h:130:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>’ and .int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/deque:64:0, from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:28, from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_deque.h:247:5: note: template<class _Tp, class _Ref, class _Ptr> bool std::operator==(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&) operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, ^ /usr/include/c++/4.8.2/bits/stl_deque.h:247:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Deque_iterator<_Tp, _Ref, _Ptr>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/deque:64:0, from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:28, from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_deque.h:254:5: note: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> bool std::operator==(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&) operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& x, ^ /usr/include/c++/4.8.2/bits/stl_deque.h:254:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Deque_iterator<_Tp, _Ref, _Ptr>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/deque:64:0, from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:28, from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_deque.h:1957:5: note: template<class _Tp, class _Alloc> bool std::operator==(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&) operator==(const deque<_Tp, _Alloc>& x, ^ /usr/include/c++/4.8.2/bits/stl_deque.h:1957:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::deque<_Tp, _Alloc>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/queue:64:0, from /root/0303/pg_jieba/libjieba/include/cppjieba/Trie.hpp:5, from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:16, from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8, from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4, from /root/0303/pg_jieba/pg_jieba.cpp:31: /usr/include/c++/4.8.2/bits/stl_queue.h:268:5: note: template<class _Tp, class _Seq> bool std::operator==(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&) operator==(const queue<_Tp, _Seq>& x, const queue<_Tp, _Seq>& y) ^ /usr/include/c++/4.8.2/bits/stl_queue.h:268:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::queue<_Tp, _Seq>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++allocator.h:33:0, from /usr/include/c++/4.8.2/bits/allocator.h:46, from /usr/include/c++/4.8.2/string:41, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/ext/new_allocator.h:139:5: note: template bool gnu_cxx::operator==(const gnu_cxx::new_allocator<_Tp>&, const gnu_cxx::new_allocator<_Tp>&) operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&) ^ /usr/include/c++/4.8.2/ext/new_allocator.h:139:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const gnu_cxx::new_allocator<_Tp>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8.2/bits/char_traits.h:39, from /usr/include/c++/4.8.2/string:40, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/stl_iterator.h:811:5: note: template<class _Iterator, class _Container> bool gnu_cxx::operator==(const gnu_cxx::__normal_iterator<_Iterator, _Container>&, const gnu_cxx::normal_iterator<_Iterator, _Container>&) operator==(const __normal_iterator<_Iterator, _Container>& lhs, ^ /usr/include/c++/4.8.2/bits/stl_iterator.h:811:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const gnu_cxx::normal_iterator<_Iterator, _Container>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8.2/bits/char_traits.h:39, from /usr/include/c++/4.8.2/string:40, from /root/0303/pg_jieba/pg_jieba.cpp:14: /usr/include/c++/4.8.2/bits/stl_iterator.h:805:5: note: template<class _IteratorL, class _IteratorR, class _Container> bool gnu_cxx::operator==(const gnu_cxx::normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::normal_iterator<_IteratorR, _Container>&) operator==(const normal_iterator<_IteratorL, _Container>& __lhs, ^ /usr/include/c++/4.8.2/bits/stl_iterator.h:805:5: note: template argument deduction/substitution failed: /root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const gnu_cxx::__normal_iterator<_IteratorL, _Container>’ and ‘int’ if (cur_iter == ctx->words->end()) { ^ /root/0303/pg_jieba/pg_jieba.cpp:332:34: error: invalid type argument of unary ‘’ (have ‘int’) type = jieba->LookupLexTypeId(cur_iter); ^ /root/0303/pg_jieba/pg_jieba.cpp:333:36: error: base operand of ‘->’ is not a pointer tlen = static_cast(cur_iter->length()); ^ /root/0303/pg_jieba/pg_jieba.cpp:334:34: error: base operand of ‘->’ is not a pointer t = const_cast<char>(cur_iter->c_str()); ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_end(FunctionCallInfo)’: /root/0303/pg_jieba/pg_jieba.cpp:343:21: error: ‘nullptr’ was not declared in this scope if (ctx->words != nullptr) { ^ /root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_lextype(FunctionCallInfo)’: /root/0303/pg_jieba/pg_jieba.cpp:353:8: error: ‘size’ does not name a type auto size = jieba->GetLexTypeSize(); ^ /root/0303/pg_jieba/pg_jieba.cpp:354:70: error: ‘size’ was not declared in this scope LexDescr descr = static_cast<LexDescr>(palloc(sizeof(LexDescr) size)); ^ make[2]: [CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o] Error 1 make[1]: [CMakeFiles/pg_jieba.dir/all] Error 2 make: *** [all] Error 2

看了其他的issue,尝试用v1.0.1版本,还是同样的环境,USE_PGXS=1 make错误 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -fpic -shared -o pg_jieba.so pg_jieba.o jieba.o -L/usr/pgsql-9.6/lib -Wl,--as-needed -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-9.6/lib',--enable-new-dtags -lstdc++ /bin/ld: jieba.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC jieba.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status make: *** [pg_jieba.so] Error 1

linmanpeng commented 6 years ago

最新的master分支的代码,cmake时加上 -DCMAKE_CXX_FLAGS="-Wall -std=c++11" 参数,就可以安装成功了

linmanpeng commented 6 years ago

还有一个问题请教一下,有办法将分词模式固定化为搜索引擎模式吗?

jaiminpan commented 6 years ago

不好意思,目前这块并不支持,动态化配置需要改动较多,需要的可以考虑自行修改源码。