Charlie Parker
Charlie Parker

Reputation: 5179

Problems installing gozmq with go get

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.

Upvotes: 6

Views: 6288

Answers (1)

OneOfOne
OneOfOne

Reputation: 99331

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.

Upvotes: 6

Related Questions