Centos 6 compiles zeromq 4.1.2 version

Currently, the version of zeromq used by the server is 4.1.2, and there is a bug:

Resource temporarily unavailable (src/signaler.cpp:282)

If you directly upgrade the version of zeromq, you may cause incompatibility problems and other program exceptions that depend on zmq. So I decided to patch it myself on 4.1.2.

There are two types of patches:

  1. https://github.com/zeromq/libzmq/pull/1584/files
  2. https://github.com/zeromq/libzmq/pull/1595/files
Compiler Environment
yum install -y git build-essential libtool autoconf automake pkg-config unzip libkrb5-dev gcc-c++  gcc

Start downloading source code && compiling

git clone https://github.com/zeromq/zeromq4-1.git
cd zeromq4-1
git checkout v4.1.2
wget https://raw.githubusercontent.com/pijyoi/libzmq/596d6e5b1c2d060b2b5b09d01f7ebd207041791d/src/mailbox.cpp -O mailbox.cpp --no-check-certificate 
wget https://raw.githubusercontent.com/pijyoi/libzmq/596d6e5b1c2d060b2b5b09d01f7ebd207041791d/src/signaler.cpp -O signaler.cpp --no-check-certificate 
wget https://raw.githubusercontent.com/pijyoi/libzmq/596d6e5b1c2d060b2b5b09d01f7ebd207041791d/src/signaler.hpp -O signaler.hpp  --no-check-certificate
sh autogen.sh
./configure
make


The following error occurs

No package 'libsodium' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables sodium_CFLAGS
and sodium_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

make: *** [config.status] 错误 1
A library libsodium is missing

requires additional compilation

cd /tmp && git clone git://github.com/jedisct1/libsodium.git && cd libsodium && git checkout e2a30a && ./autogen.sh && ./configure --prefix=/usr/ && make check && make install && ldconfig
There is a new error

autoreconf: running: aclocal --force -I m4
configure.ac:1: error: Autoconf version 2.65 or higher is required
configure.ac:1: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
Need to compile autoconf version 2.65 or higher

wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/
make && make install

Compile zeromq error

checking for sodium... configure: error: Package requirements (libsodium) were not met:

No package 'libsodium' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables sodium_CFLAGS
and sodium_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
The above error indicates that zeromq cannot find the libsodium we just compiled, and the file libsodium.pc needs to be added to /usr/lib/pkgconfig

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libsodium
Version: 0.4.3
Description: sodium library
Libs: -L${libdir} -lsodium
Cflags: -I${includedir}
At the same time, you need to add a line in /etc/ld.so.conf: /usr/lib/

echo /usr/lib >>/etc/ld.so.conf

After the above steps, the compilation is finally successful. worn out




Guess you like

Origin blog.csdn.net/codemanship/article/details/79065422