diff --git a/src/Makefile.am b/src/Makefile.am index 96b509435..ae96754a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -504,7 +504,12 @@ dragonxd_LDADD = $(LINK_GROUP_START) \ $(LIBRANDOMX) if ENABLE_WALLET -dragonxd_LDADD += $(LIBBITCOIN_WALLET) +# libbitcoin_server again after the wallet: the two archives use each other (the wallet's async +# operations derive from libbitcoin_server's AsyncRPCOperation), and GNU ld scans each archive once, +# in order. Spelled ./ on purpose: libtool drops a repeated archive, keeping only the last copy, which +# would put the server after the wallet and break the other direction. (LINK_GROUP_START/END cannot +# do it either: libtool moves both flags ahead of the archives.) +dragonxd_LDADD += $(LIBBITCOIN_WALLET) ./$(LIBBITCOIN_SERVER) endif dragonxd_LDADD += \ diff --git a/src/Makefile.gtest.include b/src/Makefile.gtest.include index 14fbf92b4..7858124a6 100644 --- a/src/Makefile.gtest.include +++ b/src/Makefile.gtest.include @@ -47,7 +47,8 @@ hush_gtest_LDADD = -lgtest -lgmock \ $(LIBSECP256K1) \ $(LIBRANDOMX) if ENABLE_WALLET -hush_gtest_LDADD += $(LIBBITCOIN_WALLET) +# libbitcoin_server again after the wallet, spelled ./ so libtool keeps both copies (see dragonxd_LDADD). +hush_gtest_LDADD += $(LIBBITCOIN_WALLET) ./$(LIBBITCOIN_SERVER) endif hush_gtest_LDADD += \