Skip to content

Commit 82793f1

Browse files
committed
Merge bitcoin/bitcoin#27146: Fix various libbitcoinkernel DLL build problems
5da7c0b build: allow libitcoinkernel dll builds now that exports are fixed (Cory Fields) 130490a build: always build bitcoin-chainstate against static libbitcoinkernel (Cory Fields) 545a74e build: fix bitcoin-chainstate when libbitcoinkernel is static (Cory Fields) 9c253d2 build: don't define DLL_EXPORT for windows (Cory Fields) Pull request description: Fixes #25008. Fixes #19772. 1. Fixup the build defines so that exports are clean. 2. Work around a libtool issue wrt dependency calculation 3. Simplify everything by only ever building in-tree bitcoin-chainstate against a static libbitcoinkernel 4. Remove Windows-only hack that disabled dll creation ACKs for top commit: TheCharlatan: ACK 5da7c0b Tree-SHA512: 61bab457e13842946387240da703d313509af30d4ca3371a19a26a5ef1716e4d7107b09567323041b549ab1fc97a064aa1d6992406936ab9c491a616bc7f4e7f
2 parents a2877f7 + 5da7c0b commit 82793f1

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ dnl we have those under control, re-enable that functionality.
7676
case $host in
7777
*mingw*)
7878
lt_cv_deplibs_check_method="pass_all"
79+
80+
dnl Remove unwanted -DDLL_EXPORT from these variables.
81+
dnl We do not use this macro, but system headers may export unwanted symbols
82+
dnl if it's set.
83+
lt_cv_prog_compiler_pic="-DPIC"
84+
lt_cv_prog_compiler_pic_CXX="-DPIC"
7985
;;
8086
esac
8187

src/Makefile.am

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,12 @@ bitcoin_chainstate_SOURCES = bitcoin-chainstate.cpp
855855
bitcoin_chainstate_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS)
856856
bitcoin_chainstate_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
857857

858-
# $(LIBTOOL_APP_LDFLAGS) deliberately omitted here so that we can test linking
859-
# bitcoin-chainstate against libbitcoinkernel as a shared or static library by
860-
# setting --{en,dis}able-shared.
861-
bitcoin_chainstate_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(PTHREAD_FLAGS)
858+
bitcoin_chainstate_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(PTHREAD_FLAGS) $(LIBTOOL_APP_LDFLAGS) -static
862859
bitcoin_chainstate_LDADD = $(LIBBITCOINKERNEL)
860+
861+
# libtool is unable to calculate this indirect dependency, presumably because it's a subproject.
862+
# libsecp256k1 only needs to be linked in when libbitcoinkernel is static.
863+
bitcoin_chainstate_LDADD += $(LIBSECP256K1)
863864
#
864865

865866
# bitcoinkernel library #
@@ -878,15 +879,6 @@ libbitcoinkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp
878879
# to export from the library.
879880
libbitcoinkernel_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -fvisibility=default
880881

881-
# TODO: For now, Specify -static in both CXXFLAGS and LDFLAGS when building for
882-
# windows targets so libtool will only build a static version of this
883-
# library. There are unresolved problems when building dll's for mingw-w64
884-
# and attempting to statically embed libstdc++, libpthread, etc.
885-
if TARGET_WINDOWS
886-
libbitcoinkernel_la_LDFLAGS += -static
887-
libbitcoinkernel_la_CXXFLAGS += -static
888-
endif
889-
890882
# TODO: libbitcoinkernel is a work in progress consensus engine library, as more
891883
# and more modules are decoupled from the consensus engine, this list will
892884
# shrink to only those which are absolutely necessary.

0 commit comments

Comments
 (0)