douyi2798
2018-11-09 07:35
浏览 1.7k
已采纳

尽管我已经安装了libpcap,但遇到“找不到lpcap”错误

Facing error with "cannot find lpcap" for make command for some package, although I have already installed libpcap.devel.

go build -i -ldflags "-linkmode external -extldflags -static -X main.version=git-6e3f8a1c7a0a" -tags netgo -o prog/weaver/weaver ./prog/weaver
# github.com/weaveworks/weave/prog/weaver
/go/pkg/tool/linux_s390x/link: running s390x-linux-gnu-gcc failed: exit status 1
/usr/lib64/gcc/s390x-suse-linux/7/../../../../s390x-suse-linux/bin/ld: cannot find -lpcap
/tmp/go-link-225248852/000015.o: In function `mygetgrouplist':
/tmp/workdir/go/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

I can see the .so files at

/usr/lib64 # ls | grep pcap

libpcap.so

libpcap.so.1

libpcap.so.1.8.1

图片转代码服务由CSDN问答提供 功能建议

针对某些软件包的make命令出现“找不到lpcap”错误,尽管我已经安装了libpcap.devel。

 开始构建-i -ldflags“ -linkmode external -extldflags -static -X main.version = git-6e3f8a1c7a0a”-标记netgo -o prog / weaver / weaver ./  prog / weaver 
#github.com/weaveworks/weave/prog/weaver
/go/pkg/tool/linux_s390x/link:运行s390x-linux-gnu-gcc失败:退出状态1 
 / usr / lib64 /  gcc / s390x-suse-linux / 7 /../../../../ s390x-suse-linux / bin / ld:找不到-lpcap 
 / tmp / go-link-225248852 / 000015.o  :在函数“ mygetgrouplist”中:
 / tmp / workdir / go / src / os / user / getgrouplist_unix.go:15:警告:在静态链接的应用程序中使用“ getgrouplist”需要在运行时使用来自glibc版本的共享库 链接
   
 
 

我可以在

/ usr / lib64#中看到.so文件。 grep pcap

libpcap.so

libpcap.so.1

libpcap.so.1.8.1

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dqvzfp6468 2018-11-09 10:43
    已采纳

    The openSUSE libpcap development RPm does not provide a static libpcap.a, so you cannot statically link libpcap unless you are able to build the static library from source (and any others to which the same applies).

    Removing -static from your -ldflags would avoid this problem, if it is an option for you to link your go program dynamically.

    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题