如何解决在 linux 上编译比特币源代码 (https://github.com/bitcoin/bitcoin) 时出现问题
问题:从 https://github.com/bitcoin/bitcoin 编译比特币源代码时出现问题
构建比特币代码需要 Berkeley DB 4.8(https://github.com/tinybike/get-bdb-4.8)。 没问题。
我的系统在 Ubuntu 20.04 上运行。
$ cpp --version
cpp (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
copyright (C) 2019 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE.
$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
copyright (C) 2019 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE.
$ g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
copyright (C) 2019 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE.
编译比特币代码时,运行'configure'和'make'后出现错误提示找不到iostream.h
...
CXX libbitcoin_server_a-txrequest.o
CXX libbitcoin_server_a-txmempool.o
CXX libbitcoin_server_a-validation.o
CXX libbitcoin_server_a-validationinterface.o
CXX libbitcoin_server_a-versionbits.o
CXX wallet/libbitcoin_server_a-init.o
In file included from ./wallet/bdb.h:27,from wallet/init.cpp:19:
/bitcoin/src/bdb/build_unix/build/include/db_cxx.h:59:10: Fatal error: iostream.h: No such file or directory
59 | #include <iostream.h>
| ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:8933: wallet/libbitcoin_server_a-init.o] Error 1
make[2]: Leaving directory '/bitcoin/src'
make[1]: *** [Makefile:15214: all-recursive] Error 1
make[1]: Leaving directory '/bitcoin/src'
make: *** [Makefile:809: all-recursive] Error 1
在检查头文件位置 /usr/include/c++/9 时我找不到 iostream.h
这是编译器包问题还是比特币没有使用 c++ iostream 头文件
解决方法
我猜您在安装所需的系统包之前尝试构建“depends”BDB,这产生了无效/无法使用的构建。
尝试删除您当前的“依赖”构建并重新构建。
或者,您可以将我的 db48 PPA 用于 Ubuntu:https://launchpad.net/~luke-jr/+archive/ubuntu/db48
,我遇到了同样的错误,但它是在我用 berkeley db 构建零冰时出现的。我发现了一些关于 libdb 的用法,其中大部分在代码的开头添加了 #define HAVE_CXX_STDHEADERS
,所以我尝试在 ICEDIR/cpp/include/IceUtil/Config.h 中添加这个定义。它有效。希望它对你有效。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。