Skip to content

Commit 48725e6

Browse files
committed
Merge #21209: build: use newer source for libnatpmp
7af2502 build: compile libnatpmp with -DNATPMP_STATICLIB on Windows (fanquake) ee35745 build: use newer source for libnatpmp (fanquake) Pull request description: The source we are currently using is from 2015. The upstream repo has received a small number of bug fixes and improvements since then. Including one that fixes an issue for Windows users: miniupnp/libnatpmp#13. The source we are currently using is the most recent "official" release, however I don't think it's worth waiting for a new one. The maintainer was prompted to do so in Oct 2020, then again in Jan of this year, and no release has eventuated. Given libnatpmp is a new inclusion into our repository, I think we should be using this newer source. This also cleans up a few warnings we currently see in Windows depends builds: ```bash Extracting libnatpmp... /home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK Preprocessing libnatpmp... Configuring libnatpmp... Building libnatpmp... make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87' x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR -c -o natpmp.o natpmp.c x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR -c -o getgateway.o getgateway.c natpmp.c:42: warning: "EWOULDBLOCK" redefined 42 | #define EWOULDBLOCK WSAEWOULDBLOCK | In file included from natpmp.c:38: /usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition 166 | #define EWOULDBLOCK 140 | natpmp.c:43: warning: "ECONNREFUSED" redefined 43 | #define ECONNREFUSED WSAECONNREFUSED | In file included from natpmp.c:38: /usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition 110 | #define ECONNREFUSED 107 | natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] 271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response) | ^~~~~~~~~~~~~~~~~~~~~~~~~ ar crs libnatpmp.a natpmp.o getgateway.o make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87' Staging libnatpmp... Postprocessing libnatpmp... Caching libnatpmp... ``` ACKs for top commit: hebasto: ACK 7af2502 Tree-SHA512: 6939014ea986149a5bfdd42b516d563a65ae643516e234579d3f28e7c2f877b0270cc4305ae7c7cb131d6d946a6e0aedc84b4cc880a412612a878a333398b9d7
2 parents ed25cb5 + 7af2502 commit 48725e6

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,9 @@ else
16691669
fi
16701670
AC_MSG_RESULT($use_natpmp_default)
16711671
AC_DEFINE_UNQUOTED([USE_NATPMP], [$natpmp_setting], [NAT-PMP support not compiled if undefined, otherwise value (0 or 1) determines default state])
1672+
if test x$TARGET_OS = xwindows; then
1673+
NATPMP_CPPFLAGS="-DSTATICLIB -DNATPMP_STATICLIB"
1674+
fi
16721675
else
16731676
AC_MSG_RESULT([no])
16741677
fi
@@ -1826,6 +1829,7 @@ AC_SUBST(SQLITE_LIBS)
18261829
AC_SUBST(TESTDEFS)
18271830
AC_SUBST(MINIUPNPC_CPPFLAGS)
18281831
AC_SUBST(MINIUPNPC_LIBS)
1832+
AC_SUBST(NATPMP_CPPFLAGS)
18291833
AC_SUBST(NATPMP_LIBS)
18301834
AC_SUBST(EVENT_LIBS)
18311835
AC_SUBST(EVENT_PTHREADS_LIBS)

depends/packages/libnatpmp.mk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package=libnatpmp
2-
$(package)_version=20150609
3-
$(package)_download_path=https://miniupnp.tuxfamily.org/files/
4-
$(package)_file_name=$(package)-$($(package)_version).tar.gz
5-
$(package)_sha256_hash=e1aa9c4c4219bc06943d6b2130f664daee213fb262fcb94dd355815b8f4536b0
2+
$(package)_version=4536032ae32268a45c073a4d5e91bbab4534773a
3+
$(package)_download_path=https://github.com/miniupnp/libnatpmp/archive
4+
$(package)_file_name=$($(package)_version).tar.gz
5+
$(package)_sha256_hash=543b460aab26acf91e11d15e17d8798f845304199eea2d76c2f444ec749c5383
66

77
define $(package)_set_vars
88
$(package)_build_opts=CC="$($(package)_cc)"
9+
$(package)_build_opts_mingw32=CPPFLAGS=-DNATPMP_STATICLIB
10+
$(package)_build_opts_darwin=LIBTOOL="$($(package)_libtool)"
911
$(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)"
1012
endef
1113

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
303303
# Contains code accessing mempool and chain state that is meant to be separated
304304
# from wallet and gui code (see node/README.md). Shared code should go in
305305
# libbitcoin_common or libbitcoin_util libraries, instead.
306-
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
306+
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
307307
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
308308
libbitcoin_server_a_SOURCES = \
309309
addrdb.cpp \

src/Makefile.test_fuzz.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TEST_FUZZ_H = \
1212
test/fuzz/FuzzedDataProvider.h \
1313
test/fuzz/util.h
1414

15-
libtest_fuzz_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
15+
libtest_fuzz_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
1616
libtest_fuzz_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
1717
libtest_fuzz_a_SOURCES = \
1818
test/fuzz/fuzz.cpp \

src/Makefile.test_util.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST_UTIL_H = \
1919
test/util/validation.h \
2020
test/util/wallet.h
2121

22-
libtest_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
22+
libtest_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
2323
libtest_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
2424
libtest_util_a_SOURCES = \
2525
test/util/blockfilter.cpp \

0 commit comments

Comments
 (0)