登录
首页 >  Golang >  Go问答

安装wirelatency时没有这样的文件或目录

来源:stackoverflow

时间:2024-04-13 10:18:30 263浏览 收藏

在Golang实战开发的过程中,我们经常会遇到一些这样那样的问题,然后要卡好半天,等问题解决了才发现原来一些细节知识点还是没有掌握好。今天golang学习网就整理分享《安装wirelatency时没有这样的文件或目录》,聊聊,希望可以帮助到正在努力赚钱的你。

问题内容

我尝试在 windows 操作系统的 pc 上安装 wirelatency。当我尝试运行 go install protocol-observer.go 时,出现以下错误:

C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:189:7: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:445:13: identifier "_Ctype_struct_pcap_stat" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:490:49: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:513:10: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:546:41: identifier "_Ctype_struct_bpf_insn" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:618:66: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:631:19: identifier "_Ctype_struct_bpf_insn" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:741:34: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:744:56: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
C:\Users\Administrator\go\pkg\mod\github.com\google\[email protected]\pcap\pcap.go:22:10: fatal error: pcap.h: No such file or directory
 #include 
          ^~~~~~~~
compilation terminated.

我该如何安装它? 有关详细信息,大多数 google 服务在我所在的位置都被屏蔽。


解决方案


似乎您需要 PCAP 标头来构建它,因为它使用 CGO 作为其依赖项之一。在 GitHub 上找到了关于这个问题的 issue,在 Stack Overflow 上找到了关于编译这种Wirelatency 依赖的 question

您还可以克隆存储库并更新依赖项,如 recent versions of gopacket doesn't need CGO anymore

到这里,我们也就讲完了《安装wirelatency时没有这样的文件或目录》的内容了。个人认为,基础知识的学习和巩固,是为了更好的将其运用到项目中,欢迎关注golang学习网公众号,带你了解更多关于的知识点!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>