安装gozmq时遇到问题,使用go get命令。

huangapple go评论82阅读模式
英文:

Problems installing gozmq with go get

问题

我正在尝试使用常规的go get命令安装gozmq:

go get github.com/alecthomas/gozmq

然而,我遇到了以下错误:

# pkg-config --cflags libzmq libzmq libzmq libzmq
exec: "pkg-config": 在$PATH中找不到可执行文件

我不太理解这个错误的含义。这是不是意味着它正在尝试运行命令# pkg-config --cflags libzmq libzmq libzmq libzmq,但由于$PATH中没有pkg-config,所以失败了?pkg-config到底是什么,为什么我需要它?我该如何安装它?

我尝试使用brew安装pkg-config,但它没有起作用,并且抛出了以下错误:

# pkg-config --cflags libzmq libzmq libzmq libzmq
在pkg-config搜索路径中找不到包libzmq。
也许你应该将包含`libzmq.pc`的目录
添加到PKG_CONFIG_PATH环境变量中。
找不到包'libzmq'
在pkg-config搜索路径中找不到包libzmq。
也许你应该将包含`libzmq.pc`的目录
添加到PKG_CONFIG_PATH环境变量中。
找不到包'libzmq'
在pkg-config搜索路径中找不到包libzmq。
也许你应该将包含`libzmq.pc`的目录
添加到PKG_CONFIG_PATH环境变量中。
找不到包'libzmq'
在pkg-config搜索路径中找不到包libzmq。
也许你应该将包含`libzmq.pc`的目录
添加到PKG_CONFIG_PATH环境变量中。
找不到包'libzmq'
退出状态1

不确定为什么会发生这种情况。

编辑:

正如第一个回答者建议的那样,我执行了以下操作:

brew install --devel zeromq

然而,在我执行go get github.com/alecthomas/gozmq之后,我遇到了以下错误:
错误:

# github.com/alecthomas/gozmq
37: error: use of undeclared identifier 'ZMQ_SWAP'
37: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
37: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
38: error: use of undeclared identifier 'ZMQ_HWM'

这些似乎是"go"的正常错误/警告。但它们来自我从网上获取的一个库。我不确定该怎么办,是否应该自己修复它们,或者应该采取什么措施来解决问题,或者向原始开发者/社区发送电子邮件或提交问题到git等。

英文:

I was trying to install gozmq with the usual go get:

go get github.com/alecthomas/gozmq

However, I was having the following error:

# pkg-config --cflags libzmq libzmq libzmq libzmq
exec: "pkg-config": executable file not found in $PATH

I don't really understand what this error means. Does it mean that its trying to run the command # pkg-config --cflags libzmq libzmq libzmq libzmqand its failing because pkg-config is not on $PATH? What is pkg-config anyway and why do I need it? how do I install it?

I tried brew installing pkg-config but it didn't work and it threw me the following error:

# pkg-config --cflags libzmq libzmq libzmq libzmq
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
exit status 1

not sure why that happened.


EDIT:

As the first answerer suggested, I did:

brew install --devel zeromq

however, I get the following error after I do go get github.com/alecthomas/gozmq
Error:

# github.com/alecthomas/gozmq
37: error: use of undeclared identifier 'ZMQ_SWAP'
37: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
37: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
38: error: use of undeclared identifier 'ZMQ_HWM'

seem to be "normal" go errors/warning. But they come from a library I got online. I am not sure what to do, if I should fix them myself or what I should to to address it or e-mail the original developers/community or git issue etc.

答案1

得分: 6

你需要安装这些库的开发版本。

$ brew install --devel zeromq

根据问题98的说明,如果你使用的是zeromq v3.x,你需要使用:

go get -tags zmq_3_x github.com/alecthomas/gozmq
# 或者如果你使用的是4x
go get -tags zmq_4_x github.com/alecthomas/gozmq

请查看README

英文:

You need to install the development versions of those libraries.

$ brew install --devel zeromq

According to issue 98, if you're using zeromq v3.x you need to use :

go get -tags zmq_3_x github.com/alecthomas/gozmq
# or if you're using 4x 
go get -tags zmq_4_x github.com/alecthomas/gozmq

Check the README.

huangapple
  • 本文由 发表于 2014年6月17日 03:32:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/24250838.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定