Skip to content

Commit f1bd03e

Browse files
committed
[depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions
1 parent 4103cc3 commit f1bd03e

7 files changed

+33
-27
lines changed

depends/packages/zeromq.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package=zeromq
2-
$(package)_version=4.2.3
2+
$(package)_version=4.2.5
33
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
44
$(package)_file_name=$(package)-$($(package)_version).tar.gz
5-
$(package)_sha256_hash=8f1e2b2aade4dbfde98d82366d61baef2f62e812530160d2e6d0a5bb24e40bc0
5+
$(package)_sha256_hash=cc9090ba35713d59bb2f7d7965f877036c49c5558ea0c290b0dcc6f2a17e489f
66
$(package)_patches=0001-fix-build-with-older-mingw64.patch 0002-disable-pthread_set_name_np.patch
77

88
define $(package)_set_vars
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
From 1a159c128c69a42d90819375c06a39994f3fbfc1 Mon Sep 17 00:00:00 2001
2-
From: Cory Fields <cory-nospam-@coryfields.com>
3-
Date: Tue, 28 Nov 2017 20:33:25 -0500
1+
From f6866b0f166ad168618aae64c7fbee8775d3eb23 Mon Sep 17 00:00:00 2001
2+
From: mruddy <6440430+mruddy@users.noreply.github.com>
3+
Date: Sat, 30 Jun 2018 09:44:58 -0400
44
Subject: [PATCH] fix build with older mingw64
55

66
---
77
src/windows.hpp | 7 +++++++
88
1 file changed, 7 insertions(+)
99

1010
diff --git a/src/windows.hpp b/src/windows.hpp
11-
index 99e889d..e69038e 100644
11+
index 6c3839fd..2c32ec79 100644
1212
--- a/src/windows.hpp
1313
+++ b/src/windows.hpp
14-
@@ -55,6 +55,13 @@
14+
@@ -58,6 +58,13 @@
1515
#include <winsock2.h>
1616
#include <windows.h>
1717
#include <mswsock.h>
@@ -23,8 +23,8 @@ index 99e889d..e69038e 100644
2323
+#include <ws2ipdef.h>
2424
+#endif
2525
#include <iphlpapi.h>
26-
26+
2727
#if !defined __MINGW32__
28-
--
29-
2.7.4
28+
--
29+
2.17.1
3030

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
From 6e6b47d5ab381c3df3b30bb0b0a6cf210dfb1eba Mon Sep 17 00:00:00 2001
2-
From: Cory Fields <cory-nospam-@coryfields.com>
3-
Date: Mon, 5 Mar 2018 14:22:05 -0500
1+
From c9bbdd6581d07acfe8971e4bcebe278a3676cf03 Mon Sep 17 00:00:00 2001
2+
From: mruddy <6440430+mruddy@users.noreply.github.com>
3+
Date: Sat, 30 Jun 2018 09:57:18 -0400
44
Subject: [PATCH] disable pthread_set_name_np
55

66
pthread_set_name_np adds a Glibc requirement on >= 2.12.
@@ -9,27 +9,27 @@ pthread_set_name_np adds a Glibc requirement on >= 2.12.
99
1 file changed, 3 insertions(+), 1 deletion(-)
1010

1111
diff --git a/src/thread.cpp b/src/thread.cpp
12-
index 4fc59c3e..c3fdfd46 100644
12+
index a1086b0c..9943f354 100644
1313
--- a/src/thread.cpp
1414
+++ b/src/thread.cpp
15-
@@ -220,7 +220,7 @@ void zmq::thread_t::setThreadName(const char *name_)
15+
@@ -307,7 +307,7 @@ void zmq::thread_t::setThreadName (const char *name_)
1616
*/
1717
if (!name_)
1818
return;
1919
-
2020
+#if 0
2121
#if defined(ZMQ_HAVE_PTHREAD_SETNAME_1)
22-
int rc = pthread_setname_np(name_);
23-
if(rc) return;
24-
@@ -233,6 +233,8 @@ void zmq::thread_t::setThreadName(const char *name_)
22+
int rc = pthread_setname_np (name_);
23+
if (rc)
24+
@@ -323,6 +323,8 @@ void zmq::thread_t::setThreadName (const char *name_)
2525
#elif defined(ZMQ_HAVE_PTHREAD_SET_NAME)
26-
pthread_set_name_np(descriptor, name_);
26+
pthread_set_name_np (descriptor, name_);
2727
#endif
2828
+#endif
2929
+ return;
3030
}
3131

3232
#endif
3333
--
34-
2.11.1
34+
2.17.1
3535

doc/build-unix.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Optional dependencies:
4747
protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when GUI enabled)
4848
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
4949
univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
50-
libzmq3 | ZMQ notification | Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.x)
50+
libzmq3 | ZMQ notification | Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.0.0)
5151

5252
For the versions used, see [dependencies.md](dependencies.md)
5353

@@ -93,7 +93,7 @@ Optional (see --with-miniupnpc and --enable-upnp-default):
9393

9494
sudo apt-get install libminiupnpc-dev
9595

96-
ZMQ dependencies (provides ZMQ API 4.x):
96+
ZMQ dependencies (provides ZMQ API):
9797

9898
sudo apt-get install libzmq3-dev
9999

doc/dependencies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
2626
| Qt | [5.9.6](https://download.qt.io/official_releases/qt/) | 5.x | No | | |
2727
| XCB | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L87) (Linux only) |
2828
| xkbcommon | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L86) (Linux only) |
29-
| ZeroMQ | [4.2.3](https://github.com/zeromq/libzmq/releases) | | No | | |
29+
| ZeroMQ | [4.2.5](https://github.com/zeromq/libzmq/releases) | 4.0.0 | No | | |
3030
| zlib | [1.2.11](https://zlib.net/) | | | | No |

doc/zmq.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ buffering or reassembly.
3333

3434
## Prerequisites
3535

36-
The ZeroMQ feature in Bitcoin Core requires ZeroMQ API version 4.x or
37-
newer. Typically, it is packaged by distributions as something like
36+
The ZeroMQ feature in Bitcoin Core requires the ZeroMQ API >= 4.0.0
37+
[libzmq](https://github.com/zeromq/libzmq/releases).
38+
For version information, see [dependencies.md](dependencies.md).
39+
Typically, it is packaged by distributions as something like
3840
*libzmq3-dev*. The C++ wrapper for ZeroMQ is *not* needed.
3941

4042
In order to run the example Python client scripts in contrib/ one must

src/zmq/zmqnotificationinterface.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ CZMQNotificationInterface* CZMQNotificationInterface::Create()
8181
// Called at startup to conditionally set up ZMQ socket(s)
8282
bool CZMQNotificationInterface::Initialize()
8383
{
84+
int major = 0, minor = 0, patch = 0;
85+
zmq_version(&major, &minor, &patch);
86+
LogPrint(BCLog::ZMQ, "zmq: version %d.%d.%d\n", major, minor, patch);
87+
8488
LogPrint(BCLog::ZMQ, "zmq: Initialize notification interface\n");
8589
assert(!pcontext);
8690

87-
pcontext = zmq_init(1);
91+
pcontext = zmq_ctx_new();
8892

8993
if (!pcontext)
9094
{
@@ -127,7 +131,7 @@ void CZMQNotificationInterface::Shutdown()
127131
LogPrint(BCLog::ZMQ, " Shutdown notifier %s at %s\n", notifier->GetType(), notifier->GetAddress());
128132
notifier->Shutdown();
129133
}
130-
zmq_ctx_destroy(pcontext);
134+
zmq_ctx_term(pcontext);
131135

132136
pcontext = nullptr;
133137
}

0 commit comments

Comments
 (0)