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

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

Problems installing gozmq with go get

问题

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

  1. go get github.com/alecthomas/gozmq

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

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

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

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

  1. # pkg-config --cflags libzmq libzmq libzmq libzmq
  2. pkg-config搜索路径中找不到包libzmq
  3. 也许你应该将包含`libzmq.pc`的目录
  4. 添加到PKG_CONFIG_PATH环境变量中。
  5. 找不到包'libzmq'
  6. pkg-config搜索路径中找不到包libzmq
  7. 也许你应该将包含`libzmq.pc`的目录
  8. 添加到PKG_CONFIG_PATH环境变量中。
  9. 找不到包'libzmq'
  10. pkg-config搜索路径中找不到包libzmq
  11. 也许你应该将包含`libzmq.pc`的目录
  12. 添加到PKG_CONFIG_PATH环境变量中。
  13. 找不到包'libzmq'
  14. pkg-config搜索路径中找不到包libzmq
  15. 也许你应该将包含`libzmq.pc`的目录
  16. 添加到PKG_CONFIG_PATH环境变量中。
  17. 找不到包'libzmq'
  18. 退出状态1

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

编辑:

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

  1. brew install --devel zeromq

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

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

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

英文:

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

  1. go get github.com/alecthomas/gozmq

However, I was having the following error:

  1. # pkg-config --cflags libzmq libzmq libzmq libzmq
  2. 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:

  1. # pkg-config --cflags libzmq libzmq libzmq libzmq
  2. Package libzmq was not found in the pkg-config search path.
  3. Perhaps you should add the directory containing `libzmq.pc'
  4. to the PKG_CONFIG_PATH environment variable
  5. No package 'libzmq' found
  6. Package libzmq was not found in the pkg-config search path.
  7. Perhaps you should add the directory containing `libzmq.pc'
  8. to the PKG_CONFIG_PATH environment variable
  9. No package 'libzmq' found
  10. Package libzmq was not found in the pkg-config search path.
  11. Perhaps you should add the directory containing `libzmq.pc'
  12. to the PKG_CONFIG_PATH environment variable
  13. No package 'libzmq' found
  14. Package libzmq was not found in the pkg-config search path.
  15. Perhaps you should add the directory containing `libzmq.pc'
  16. to the PKG_CONFIG_PATH environment variable
  17. No package 'libzmq' found
  18. exit status 1

not sure why that happened.


EDIT:

As the first answerer suggested, I did:

  1. brew install --devel zeromq

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

  1. # github.com/alecthomas/gozmq
  2. 37: error: use of undeclared identifier 'ZMQ_SWAP'
  3. 37: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
  4. 37: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
  5. 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

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

  1. $ brew install --devel zeromq

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

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

请查看README

英文:

You need to install the development versions of those libraries.

  1. $ brew install --devel zeromq

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

  1. go get -tags zmq_3_x github.com/alecthomas/gozmq
  2. # or if you're using 4x
  3. 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:

确定