Altcoin
建構 Bitcoin-ABC 分叉的 C++ 錯誤
我正在創建一個基於 Bitcoin-ABC 的山寨幣,當我為我的 Ubuntu 機器動態編譯時一切都很好,但是當我嘗試製作靜態發布版本時,我得到:
CXXLD libbitcoinconsensus.la .libs/libbitcoinconsensus_la-arith_uint256.o: In function `base_uint<256u>::GetHex() const': /root/xeroxcoin/src/arith_uint256.cpp:135: undefined reference to `base_blob<256u>::GetHex() const' .libs/libbitcoinconsensus_la-arith_uint256.o: In function `uint256S(char const*)': /root/xeroxcoin/src/uint256.h:123: undefined reference to `base_blob<256u>::SetHex(char const*)' primitives/.libs/libbitcoinconsensus_la-block.o: In function `CBlock::ToString[abi:cxx11]() const': /root/xeroxcoin/src/primitives/block.cpp:23: undefined reference to `base_blob<256u>::ToString() const' /root/xeroxcoin/src/primitives/block.cpp:22: undefined reference to `base_blob<256u>::ToString() const' /root/xeroxcoin/src/primitives/block.cpp:22: undefined reference to `base_blob<256u>::ToString() const' primitives/.libs/libbitcoinconsensus_la-transaction.o: In function `COutPoint::ToString[abi:cxx11]() const': /root/xeroxcoin/src/primitives/transaction.cpp:13: undefined reference to `base_blob<256u>::ToString() const' primitives/.libs/libbitcoinconsensus_la-transaction.o: In function `CTransaction::ToString[abi:cxx11]() const': /root/xeroxcoin/src/primitives/transaction.cpp:132: undefined reference to `base_blob<256u>::ToString() const' script/.libs/libbitcoinconsensus_la-interpreter.o: In function `uint256S(char const*)': /root/xeroxcoin/src/./uint256.h:123: undefined reference to `base_blob<256u>::SetHex(char const*)' collect2: error: ld returned 1 exit status Makefile:3619: recipe for target 'libbitcoinconsensus.la' failed make[2]: *** [libbitcoinconsensus.la] Error 1 make[2]: Leaving directory '/root/xeroxcoin/src' Makefile:9581: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/root/xeroxcoin/src' Makefile:690: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1
這幾乎是普通的 Bitcoin-ABC 程式碼,在我看來 base_blob 確實存在並且確實有這些方法。幫助?
我有同樣的問題。可以通過使用另一個版本的 libdb 來解決。目前的 Ubuntu (17.10) 附帶 libdb 3.5,但需要 4。您可以下載並建構它
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' tar -xzvf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix/ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/yourfavoritepath/db4/ make install
要讓編譯器在建構時使用它,請像這樣呼叫配置腳本
./configure LDFLAGS="-L/yourfavoritepath/db4/lib/" CPPFLAGS="-I/yourfavoritepath/db4/include/"
然後你可以用 make 建構。請務必將您最喜歡的路徑更改為要保存 libdb4 的任何位置。