yanyiwu / gojieba

"结巴"中文分词的Golang版本
MIT License
2.39k stars 302 forks source link

安装候报错 #78

Open linkyang opened 3 years ago

linkyang commented 3 years ago

环境:vscode ,mingw-w64-v8.0.0 安装结巴候,编译报错了,我卸载掉了mingw-w64 也不 附件加载了错误日志,麻烦看看谢谢! jieba_error.txt

NicYan commented 3 years ago

我也遇到同样得问题了 go get github.com/yanyiwu/gojieba 报错:cgo: exec gcc: exec: "gcc": executable file not found in $PATH 然后安装mingw-w64,再执行go get github.com/yanyiwu/gojieba 出现和你同样得问题了,请问你解决这个报错了么

bwangelme commented 3 years ago
# github.com/yanyiwu/gojieba
In file included from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Unicode.hpp:9,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/DictTrie.hpp:15,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/QuerySegment.hpp:8,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Jieba.hpp:4,
                 from jieba.cpp:5:
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp: In instantiation of 'void limonp::LocalVector<T>::reserve(size_t) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>; size_t = long long unsigned int]':
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp:83:7:   required from 'void limonp::LocalVector<T>::push_back(const T&) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>]'
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Trie.hpp:99:81:   required from here
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp:95:11: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(ptr_, old, sizeof(T) * capacity_);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/utility:70,
                 from D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/algorithm:60,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/QuerySegment.hpp:4,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Jieba.hpp:4,
                 from jieba.cpp:5:
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:198:12: note: 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' declared here
     struct pair
            ^~~~
In file included from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Unicode.hpp:9,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/DictTrie.hpp:15,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/QuerySegment.hpp:8,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Jieba.hpp:4,
                 from jieba.cpp:5:
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp: In instantiation of 'limonp::LocalVector<T>& limonp::LocalVector<T>::operator=(const limonp::LocalVector<T>&) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>]':
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp:33:11:   required from 'limonp::LocalVector<T>::LocalVector(const limonp::LocalVector<T>&) [with T = std::pair<long long unsigned int, const cppjieba::DictUnit*>]'
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Trie.hpp:28:8:   required from 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = cppjieba::Dag; _Args = {const cppjieba::Dag&}]'
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:83:18:   required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*; bool _TrivialValueTypes = false]'
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:134:15:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*]'
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:289:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = const cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*; _Tp = cppjieba::Dag]'
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_uninitialized.h:311:2:   required from '_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = cppjieba::Dag*; _ForwardIterator = cppjieba::Dag*; _Allocator = std::allocator<cppjieba::Dag>]'
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/vector.tcc:611:7:   required from 'void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = cppjieba::Dag; _Alloc = std::allocator<cppjieba::Dag>; std::vector<_Tp, _Alloc>::size_type = long long unsigned int]'
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:827:4:   required from 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = cppjieba::Dag; _Alloc = std::allocator<cppjieba::Dag>; std::vector<_Tp, _Alloc>::size_type = long long unsigned int]'
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Trie.hpp:86:27:   required from here
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp:63:13: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
       memcpy(ptr_, vec.ptr_, vec.size() * sizeof(T));
       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/utility:70,
                 from D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/algorithm:60,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/QuerySegment.hpp:4,
                 from ..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/cppjieba/Jieba.hpp:4,
                 from jieba.cpp:5:
D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:198:12: note: 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' declared here
     struct pair
            ^~~~
# ems_jieba
D:\gowork\src\ems_jieba\main.go:12:2: x declared but not used

这个不是报错吧,是两个警告

D:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:198:12: note: 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' declared here
     struct pair
..\..\pkg\mod\github.com\yanyiwu\gojieba@v1.1.2\deps/limonp/LocalVector.hpp:63:13: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct std::pair<long long unsigned int, const cppjieba::DictUnit*>' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
       memcpy(ptr_, vec.ptr_, vec.size() * sizeof(T));
       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bwangelme commented 2 years ago

上述警告已经在 #70 中修复了。

由于作者没有发新的 release,可使用 go get github.com/yanyiwu/gojieba@master 安装包含最新 commit 的代码。