Hi pebbe,
I am inclined to say that something is broken with the way pebbe/zqm4 is checking for zmq lib versions or I am really overlooking something here. any help is appreciated.
please have a look at this. I will give you the whole workflow I do here.
let's start with a clean go environment:
~ $ rm -rf gocode/src/github.com/pebbe/
~ $ rm -rf gocode/pkg/
~ $ go get -u github.com/pebbe/zmq4
# pkg-config --cflags 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
pkg-config: exit status 1
~ $
so far so good. zmq4 is missing libzmq package. which is right. because I have none installed yet.
so let's do that:
~ $ sudo apt-cache policy libczmq-dev
libczmq-dev:
Installed: (none)
Candidate: 4.1.0
Version table:
4.1.0 500
500 http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0 ./ Packages
3.0.2-5 500
500 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
~ $
notice that I am downloading from official zmq repository for debian9.0/ubuntu like said on http://czmq.zeromq.org/page:get-the-software
now let's check if we really have no libzmq libs installed:
~ $ ll /usr/lib/x86_64-linux-gnu/libzmq*
ls: cannot access '/usr/lib/x86_64-linux-gnu/libzmq*': No such file or directory
now let's install libczmq-dev finally:
~ $ sudo apt-get install libczmq-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libczmq4 libnorm1 libsodium18 libsystemd-dev libzmq3-dev libzmq5
The following NEW packages will be installed:
libczmq-dev libczmq4 libnorm1 libsodium18 libsystemd-dev libzmq3-dev libzmq5
0 upgraded, 7 newly installed, 0 to remove and 178 not upgraded.
Need to get 0 B/1,331 kB of archives.
After this operation, 5,340 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Selecting previously unselected package libnorm1:amd64.
(Reading database ... 237362 files and directories currently installed.)
Preparing to unpack .../libnorm1_1.5r6+dfsg1-1_amd64.deb ...
Unpacking libnorm1:amd64 (1.5r6+dfsg1-1) ...
Selecting previously unselected package libsodium18:amd64.
Preparing to unpack .../libsodium18_1.0.8-5_amd64.deb ...
Unpacking libsodium18:amd64 (1.0.8-5) ...
Selecting previously unselected package libzmq5:amd64.
Preparing to unpack .../libzmq5_4.2.3_amd64.deb ...
Unpacking libzmq5:amd64 (4.2.3) ...
Selecting previously unselected package libzmq3-dev:amd64.
Preparing to unpack .../libzmq3-dev_4.2.3_amd64.deb ...
Unpacking libzmq3-dev:amd64 (4.2.3) ...
Selecting previously unselected package libsystemd-dev:amd64.
Preparing to unpack .../libsystemd-dev_229-4ubuntu21.1_amd64.deb ...
Unpacking libsystemd-dev:amd64 (229-4ubuntu21.1) ...
Selecting previously unselected package libczmq4.
Preparing to unpack .../libczmq4_4.1.0_amd64.deb ...
Unpacking libczmq4 (4.1.0) ...
Selecting previously unselected package libczmq-dev.
Preparing to unpack .../libczmq-dev_4.1.0_amd64.deb ...
Unpacking libczmq-dev (4.1.0) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libnorm1:amd64 (1.5r6+dfsg1-1) ...
Setting up libsodium18:amd64 (1.0.8-5) ...
Setting up libzmq5:amd64 (4.2.3) ...
Setting up libzmq3-dev:amd64 (4.2.3) ...
Setting up libsystemd-dev:amd64 (229-4ubuntu21.1) ...
Setting up libczmq4 (4.1.0) ...
Setting up libczmq-dev (4.1.0) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
~ $
check again:
~ $ ll /usr/lib/x86_64-linux-gnu/libzmq*
-rw-r--r-- 1 root root 1.8M Dec 31 2014 /usr/lib/x86_64-linux-gnu/libzmq.a
lrwxrwxrwx 1 root root 15 Dec 31 2014 /usr/lib/x86_64-linux-gnu/libzmq.so -> libzmq.so.5.1.3
lrwxrwxrwx 1 root root 15 Dec 31 2014 /usr/lib/x86_64-linux-gnu/libzmq.so.5 -> libzmq.so.5.1.3
-rw-r--r-- 1 root root 596K Dec 31 2014 /usr/lib/x86_64-linux-gnu/libzmq.so.5.1.3
~ $
5.1.3 stands for version 4.2.3 here.
now let's see what pkgconfig would say to pebbe/zmq4 if pebbe/zmq4 were to ask for it when we go get this repository:
~ $ cat /usr/lib/x86_64-linux-gnu/pkgconfig/libzmq.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name: libzmq
Description: 0MQ c++ library
Version: 4.2.3
Libs: -L${libdir} -lzmq
Libs.private: -lstdc++ -lsodium -lpgm -lpthread -lm -lnorm
Cflags: -I${includedir}
~ $
notice: it says you will find the libzmq packages/libs in /usr/lib/x86_64-linux-gnu/
with version 4.2.3
.
so far so good. let's continue to go get this repository finally:
~ $ go get -u github.com/pebbe/zmq4
~ $
worked. now let's continue to build our go application:
~/gocode/src/github.com/omani/lol/cmd (master [uncommited!]) $ go build -o lol main.go
~/gocode/src/github.com/omani/lol/cmd (master [uncommited!]) $
worked.
now let's run the just created binary:
~/gocode/src/github.com/omani/lol/cmd (master [uncommited!]) $ ./lol
USAGE:
lol -c=<string> --identity=<string>
[--debug]
lol --help
lol --version
Use 'lol --help' to get detailed information about options and examples of usage.
~/gocode/src/github.com/omani/lol/cmd (master [uncommited!]) $
so at first sight, it seems to work. but that's just an illusion. this is only flags
doing it's job and returning due to missing arguments. we never really ran the app. so now let's give the application some working cli arguments to see what really happens:
~/gocode/src/github.com/omani/lol/cmd (master [uncommited!]) $ ./lol -c ~/lol.toml -identity lol01 -debug
2018/03/10 15:27:57 zmq4 was installed with ZeroMQ version 4.2.4, but the application links with version 4.2.3
~/gocode/src/github.com/omani/lol/cmd (master [uncommited!]) $
there you go. the app does not start because it's complaining about zmq.
now here is my question:
How can this even be? As you can see we installed libczmq version 4.2.3. and all it's dependencies for version 4.2.3. Why should this ever happen that zmq4
is thinking we had version 4.2.4 during the time we ran go get github.com/pebbe/zmq4
? You see what pkgconfig said which version we have installed and I assume that is the same information zmq4
is getting.
so where does version 4.2.4 come from?
thanks.