build: list libbitcoin_server again after libbitcoin_wallet when linking

libbitcoin_server and libbitcoin_wallet use each other: the server's init and RPC code calls into
the wallet, and the wallet's async operations derive from the server's AsyncRPCOperation. GNU ld
(Linux and mingw) scans each static archive once, in order, so dragonxd and hush-gtest only linked
because some server object happened to reference asyncrpcoperation.o directly and pull it in on the
first pass: AsyncRPCQueue called the non-virtual AsyncRPCOperation::cancel(). Making cancel()
virtual, as the next commit does, removes that reference, and dragonxd fails to link with undefined
AsyncRPCOperation members from libbitcoin_wallet.a.

List libbitcoin_server again after the wallet, spelled ./libbitcoin_server.a: libtool drops a
repeated archive and keeps only its last copy, which would put the server after the wallet and break
the other direction, and it compares the literal strings. LINK_GROUP_START/END cannot do it either:
libtool moves both flags ahead of all the archives, so the group is empty (that is true of the
existing mingw link group too). macOS's ld64 does not depend on archive order; a repeated archive is
at most a warning there.

test_bitcoin already lists the server twice but is not built (its include is commented out in
Makefile.am); if it is revived it needs the same spelling.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-20 19:04:51 -06:00
co-authored by Claude Opus 5.5
parent 227cc7730b
commit b0e0d211d2
2 changed files with 8 additions and 2 deletions
+6 -1
View File
@@ -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 += \
+2 -1
View File
@@ -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 += \