Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac上编译Linux可用的文件报错 #53

Open
weichangdong opened this issue Jan 17, 2024 · 1 comment
Open

mac上编译Linux可用的文件报错 #53

weichangdong opened this issue Jan 17, 2024 · 1 comment

Comments

@weichangdong
Copy link

多谢楼主的这个工具,很牛逼的样子。mac本地可以使用。
我想编译一个在Linux机器上使用,但是报错。

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o go-sniffer main.go

../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:30:22: undefined: pcapErrorNotActivated
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:52:17: undefined: pcapTPtr
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:64:10: undefined: pcapPkthdr
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:103:6: undefined: pcapBpfProgram
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:110:7: undefined: pcapPkthdr
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:268:33: undefined: pcapErrorActivated
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:269:33: undefined: pcapWarningPromisc
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:270:33: undefined: pcapErrorNoSuchDevice
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:271:33: undefined: pcapErrorDenied
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:748:14: undefined: pcapTPtr
../pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap.go:271:33: too many errors
@weichangdong
Copy link
Author

在Linux上安装 也会报错

go: found github.com/google/gopacket/tcpassembly/tcpreader in github.com/google/gopacket v1.1.19
# github.com/google/gopacket/pcap
../go/pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap_unix.go:34:10: fatal error: pcap.h: No such file or directory
   34 | #include <pcap.h>
      |          ^~~~~~~~
compilation terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant