gojieba icon indicating copy to clipboard operation
gojieba copied to clipboard

go mod 管理依赖时,运行项目报错

Open job2wd opened this issue 5 years ago • 8 comments

github.com/yanyiwu/gojieba

In file included from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Unicode.hpp:9, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/DictTrie.hpp:15, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:8, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4, from jieba.cpp:5: D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\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]': D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\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*>]' D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Trie.hpp:99:81: required from here D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\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:/ProgramFiles/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/utility:70, from D:/ProgramFiles/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/algorithm:60, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:4, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4, from jieba.cpp:5: D:/ProgramFiles/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 D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Unicode.hpp:9, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/DictTrie.hpp:15, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:8, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4, from jieba.cpp:5: D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\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*>]': D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\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*>]' D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Trie.hpp:28:8: required from 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = cppjieba::Dag; _Args = {const cppjieba::Dag&}]' D:/ProgramFiles/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:/ProgramFiles/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:/ProgramFiles/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:/ProgramFiles/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::allocatorcppjieba::Dag]' D:/ProgramFiles/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::allocatorcppjieba::Dag; std::vector<_Tp, _Alloc>::size_type = long long unsigned int]' D:/ProgramFiles/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::allocatorcppjieba::Dag; std::vector<Tp, Alloc>::size_type = long long unsigned int]' D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Trie.hpp:86:27: required from here D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\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:/ProgramFiles/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/utility:70, from D:/ProgramFiles/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/algorithm:60, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/QuerySegment.hpp:4, from D:\ProgramFiles\Go\gopath\pkg\mod\github.com\yanyiwu\[email protected]\deps/cppjieba/Jieba.hpp:4, from jieba.cpp:5: D:/ProgramFiles/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 ^~~~


请问怎么处理?谢谢!

job2wd avatar Dec 06 '19 07:12 job2wd

我的 Golang 1.13

job2wd avatar Dec 06 '19 07:12 job2wd

同样遇到了这个问题 golang version v1.13.5 cmake version 3.14.3 gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

xiaoer105 avatar Dec 25 '19 03:12 xiaoer105

没人解答下吗,我也是,window上的

walkerxy avatar Dec 27 '19 09:12 walkerxy

@yanyiwu 您好,有空帮忙解答下吗

xiaoer105 avatar Jan 12 '20 07:01 xiaoer105

发现 v 1.1.0 这个版本是没有 mod 文件的,刚刚看大佬最近提交上传了mod 文件,尝试把最新的项目 clone 下来,然后放到项目的 vendor 文件夹里面(没有vendor 文件夹可手动新增),然后在 mod 文件新增 replace github.com/yanyiwu/gojieba v1.1.0 => ./vendor/gojieba 和 require (github.com/yanyiwu/gojieba v1.1.0)运行没报错了

xiaoer105 avatar Jan 12 '20 08:01 xiaoer105

所以就是 https://github.com/yanyiwu/gojieba/pull/60 这个pr修复了这个问题,是么?

yanyiwu avatar Jan 12 '20 16:01 yanyiwu

我拉的最新版本1.1.2,也还存在这个问题

shitsurei avatar Sep 15 '20 02:09 shitsurei

我也是遇到的同样问题 readme上的go get语句默认给我拉取的就是1.1.2版本 我这小项目不怂直接拉master分支就好了,给我的是1.1.3 go get github.com/yanyiwu/gojieba@master

zephms avatar Sep 24 '21 23:09 zephms