无法在Mac OS X上运行用于Golang的zmq,原因未知。

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

Unable to run zmq for golang on a mac os X, unknown issue

问题

我正在尝试在我的Go项目中使用gozmq和ZMQ,但是遇到了一些问题,不太确定问题出在哪里。

当我像这样运行我的应用程序时:

$ go run main.go

我得到了以下结果:

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

我实际上不知道这是什么意思,为什么会出现这个问题。然而,我猜想可能是我没有安装zmq,或者无法找到它之类的问题...所以我使用brew安装了它:

brew install zmq

但是我得到了以下结果:

Warning: zeromq-4.0.4 already installed

所以我知道我已经安装了它。即使它已经安装了,它仍然无法工作,很奇怪吧?

gozmq的说明中,确实提到了使用以下命令来安装4.x版本:

go get -tags zmq_4_x github.com/alecthomas/gozmq

我确实运行了:

go get -tags zmq_4_x github.com/alecthomas/gozmq

go get -tags zmq_4_0 github.com/alecthomas/gozmq

go get -tags zmq_4_0_4 github.com/alecthomas/gozmq

我以为最后一个命令会生效,因为它与我安装的版本匹配,但是以上所有命令都没有生效。

实际上,它们都返回了熟悉的错误信息:

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

作为最后的尝试,我尝试访问(官方网站):

http://zeromq.org/docs:source-git

来安装它,但是他们针对MAC OS X和类Unix系统的说明在我的电脑上不起作用。有人知道发生了什么吗?我还应该尝试什么?

英文:

I was trying to use gozmq for my go project with ZMQ however, I was having some problems and wasn't really sure what the problem was.

When I run my application with zmq as in:

$ go run main.go

I get back:

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

I don't actually know what it means or why it comes up. However, I guessed that I didn't install zmq or it cannot find it or something...so I brew installed it with

brew install zmq

But I get:

Warning: zeromq-4.0.4 already installed

So I know that I already installed it. Even though its installed it doesn't work, weird?

The instruction at gozmq do say to run for 4.x install with:

go get -tags zmq_4_x github.com/alecthomas/gozmq

I literally ran:

go get -tags zmq_4_x github.com/alecthomas/gozmq

and

go get -tags zmq_4_0 github.com/alecthomas/gozmq

and

go get -tags zmq_4_0_4 github.com/alecthomas/gozmq

I thought the last one would work since it matches the version I had but non of the above worked.

In fact they all just returned the familiar error:

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

As a last resource I tried to go to (the official site) at:

http://zeromq.org/docs:source-git

to install it but the instruction they have for MAC OS X and Unix-like systems does not work for my computer. Does anyone know whats going on? What else should I try?

答案1

得分: 4

pkg-config的问题很容易解决。我只需按照建议中的重复安装它。

然而,如果你仔细看一下,我安装的是4.0.4版本的zmq,这似乎是gozmq不完全支持的版本(或者它不工作,因为编译器抛出错误)。

然后我不得不去安装zmq的3.2.4版本,并安装适用于该版本的gozmq。

要做到这一点,请参考https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula,该链接展示了如何在brew中安装特定版本的任何软件。

英文:

The problem for pkg-config was easy to solve. I just brew installed it as the duplicate suggested.

However,if you look a little closer, I had 4.0.4. Which seems to be a version of zmq that is not properly supported by gozmq (or it doesn't work because it has errors thrown by the compiler).

I had to then go and brew install zmq but version 3.2.4 and then install the gozmq version for that zmq version.

To do that read https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula that shows you how to install a specific version of anything in brew.

huangapple
  • 本文由 发表于 2014年8月19日 10:05:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/25374631.html
匿名

发表评论

匿名网友

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

确定