【问题标题】:Problem compiling bitcoin source code(https://github.com/bitcoin/bitcoin) on linux在linux上编译比特币源代码(https://github.com/bitcoin/bitcoin)的问题
【发布时间】:2021-02-24 02:02:55
【问题描述】:

问题:从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 头文件

【问题讨论】:

  • 你关注the instructions了吗?
  • 是的,我做到了。正如我所提到的,我不知道是我的编译器包缺少 iostream.h 还是比特币代码没有正确定义 /bitcoin/src/bdb/build_unix/build/include/db_cxx.h 中的宏 HAVE_CXX_STDHEADERS 以使用 iostream
  • 定义 HAVE_CXX_STDHEADERS 不是比特币的工作。这通常是 db_cxx.h 的一部分(紧接在 #ifdef 检查它之前)。您的 db4.8 构建有问题。

标签: bitcoind


【解决方案1】:

我猜你在安装所需的系统包之前尝试构建“依赖”BDB,而这产生了无效/不可用的构建。

尝试删除您当前的“依赖”构建并重新构建它们。

或者,您可以只使用我的 db48 PPA for Ubuntu:https://launchpad.net/~luke-jr/+archive/ubuntu/db48

【讨论】:

  • /bitcoin/doc/build-unix.md 中指定的所需系统包都在构建 Berkeley DB 4.8 之前安装(除了 qt 的东西)。 BDB 构建成功。然后构建比特币代码接下来我将尝试您为 Berkeley DB 4.8 指定的链接
  • 您得到的错误意味着 BDB 构建不成功。它产生了一个无效的 db_cxx.h 文件。
  • 我使用了launchpad.net/~luke-jr/+archive/ubuntu/db48你的bdb4.8版本,比特币代码编译成功。话虽如此,来自github.com/tinybike/get-bdb-4.8 的 bdb4.8 是问题的根源。你的版本有什么区别,你为什么要创建它?谢谢
  • 我不知道那个随机的 github repo 是做什么的,但我的只是来自 Ubuntu 的原始 bdb4.8 包源代码(在他们删除它之前),删除了 Java 支持(因为它与较新的Java 的东西)
【解决方案2】:

我遇到了同样的错误,但是当我使用 berkeley db 构建零冰时出现了。我发现了一些关于 libdb 的用法,其中大多数在代码开头添加了#define HAVE_CXX_STDHEADERS,所以我尝试在 ICEDIR/cpp/include/IceUtil/Config.h 中添加这个定义。它有效。希望它对你有效。

【讨论】:

    【解决方案3】:

    在 db4.8 编译过程中出现了完全错误 但作为临时修复,您可以添加 包含/db_cxx.h

    #define HAVE_CXX_STDHEADERS 1 这可能会有所帮助,但取决于。

    恕我直言 为比特币构建 db-4.8 的最正确方法

    wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
    tar zxvf db-4.8.30.NC.tar.gz
    cd db-4.8.30.NC
    build_unix/
    ../dist/configure --prefix=/usr/local/db48 --enable-cxx --with-pic --disable-replication --disable-shared
    make install 
    cd ../bitcoin-x.x
    export BDB_PREFIX=/usr/local/db48
    export BDB_LIBS="-L/usr/local/db48/lib -ldb_cxx-4.8"
    export BDB_CFLAGS="-I/usr/local/db48/include"
    ./configure
    

    等等

    【讨论】:

      猜你喜欢
      • 2021-07-05
      • 1970-01-01
      • 2018-08-06
      • 2019-12-04
      • 2020-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多