centos 6编译zeromq 4.1.2版本

3 篇文章 0 订阅
1 篇文章 0 订阅

目前,服务器使用的zeromq的版本是4.1.2, 存在一个bug:

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

如果直接升级zeromq的版本担心引起不兼容问题,以及其他依赖zmq的程序异常。所以决定在4.1.2上自己打补丁。

补丁打法有两种:

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

开始下载源码&&编译

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


出现如下报错

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
缺少一个库libsodium

需要额外编译

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
又出现新的报错

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
需要编译2.65版本以上的autoconf

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

编译zeromq报错

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.
上述报错说明zeromq无法找到我们刚才编译的libsodium,需要在/usr/lib/pkgconfig增加文件libsodium.pc

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}
同时需要在/etc/ld.so.conf增加一行:/usr/lib/

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

经过以上步骤终于编译成功了。累死了




  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值