go 项目编译失败
Posted dy blog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了go 项目编译失败相关的知识,希望对你有一定的参考价值。
[email protected]:~/sunteng/src/dsp_masky/bin/bid$ go build server.go # github.com/coreos/go-etcd/etcd /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:99:6: r.EncodeArrayStart undefined (type codec.encDriver has no field or method EncodeArrayStart) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:107:6: r.EncodeMapStart undefined (type codec.encDriver has no field or method EncodeMapStart) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:111:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:119:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:121:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:130:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:142:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:144:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:157:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:170:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState) /home/ubuntu/go/src/github.com/coreos/go-etcd/etcd/response.generated.go:170:6: too many errors # dsp_masky/library/db/shm_index /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_GetLastError’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:52:对‘GetLastError’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_GetVersion’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:69:对‘GetVersion’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashDestroy’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:99:对‘HashDestroy’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashGet’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:119:对‘HashGet’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashHeadToString’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:136:对‘HashHeadToString’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashToString’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:191:对‘HashToString’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_NewHash’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:210:对‘NewHash’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_FreeHash’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:37:对‘FreeHash’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashClean’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:83:对‘HashClean’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashInit’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:150:对‘HashInit’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashRebuild’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:162:对‘HashRebuild’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_HashSet’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:176:对‘HashSet’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/hash.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_SetVersion’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:225:对‘SetVersion’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexError’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:64:对‘IndexError’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexGetTop’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:82:对‘IndexGetTop’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexInit’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:100:对‘IndexInit’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexResize’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:119:对‘IndexResize’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexUpdate’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:151:对‘IndexUpdate’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_NewIndex’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:171:对‘NewIndex’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_NextHash’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:188:对‘NextHash’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_TopHash’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:205:对‘TopHash’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_FreeIndex’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:37:对‘FreeIndex’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexClear’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:49:对‘IndexClear’未定义的引用 /tmp/go-build128556831/dsp_masky/library/db/shm_index/_obj/index.cgo2.o:在函数‘_cgo_74c72ce7a376_Cfunc_IndexSetTop’中: /tmp/go-build/dsp_masky/library/db/shm_index/_obj/cgo-gcc-prolog:135:对‘IndexSetTop’未定义的引用 collect2: error: ld returned 1 exit status
第一部分错误是github.com/coreos/go-etcd/包版本不对,不能clone master,新版本有较大变动,要clone release-0.4版本
第二部分错误是因为gcc编译失败,因为没有写权限,到gcc文件目录下make就可以看到报错,用root用户先将c++文件编译好再编译go文件即可
以上是关于go 项目编译失败的主要内容,如果未能解决你的问题,请参考以下文章
开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
go语言学习笔记 — 基础 — go工具:一键获取源代码,编译并安装 —— go get
Android 逆向Android 逆向通用工具开发 ( Android 平台运行的 cmd 程序类型 | Android 平台运行的 cmd 程序编译选项 | 编译 cmd 可执行程序 )(代码片段