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:
@@ -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 += \
|
||||
|
||||
Reference in New Issue
Block a user