2

我正在尝试在 debian 8 上安装开源项目 Open Transactions。我已经安装了所有依赖项,并且在编译(make)时遇到了问题。即使我确保安装了 protobuf 项目,我的终端仍显示以下错误:

In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:64:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Generics.pb.h:501:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:65:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Markets.pb.h:2062:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:66:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Bitcoin.pb.h:833:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:67:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Moneychanger.pb.h:1026:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
cc1plus: all warnings being treated as errors
src/core/CMakeFiles/opentxs-core.dir/build.make:1368: recipe for target 'src/core/CMakeFiles/opentxs-core.dir/OTStorage.cpp.o' failed
make[2]: *** [src/core/CMakeFiles/opentxs-core.dir/OTStorage.cpp.o] Error 1
make[2]: Leaving directory '/root/opentxs/build'
CMakeFiles/Makefile2:586: recipe for target 'src/core/CMakeFiles/opentxs-core.dir/all' failed
make[1]: *** [src/core/CMakeFiles/opentxs-core.dir/all] Error 2
make[1]: Leaving directory '/root/opentxs/build'
Makefile:150: recipe for target 'all' failed
make: *** [all] Error 2

关于如何处理这个问题的任何想法?在网上找不到任何帮助。

4

2 回答 2

8

我在 Ubuntu 14.04 上遇到了同样的问题,我按照你的说法修复了它。但我只是写信来解释更多的问题。
所以,在谷歌搜索错误后,我发现了这个讨论 。他们在其中描述了问题源于谷歌编码器依赖于这样一个事实,即 C++ 标准允许您将未定义的预处理器符号视为评估为 0。因此有一堆 #if 指令测试值PROTOBUF_INLINE_NOT_IN_HEADERS当它没有在任何地方定义时;这是合法的,应该被视为零。
我通过-DPROTOBUF_INLINE_NOT_IN_HEADERS=0在 src/SConscript (CXXFLAGS) 的顶级 SConstruct 和 CXXFLAGS 中添加 CCFLAGS 来解决此问题,这似乎抓住了它。

所以要解决这个问题,你应该在你在 opentxs 主文件夹中找到的 CMakeList.txt 中添加这一行:

添加定义(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)

并且不要忘记重复该cmake步骤。

希望这更清楚,更有帮助。

于 2015-12-27T21:27:47.623 回答
0

通过在 CMakelists.txt 顶部添加此行来解决此问题

add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
于 2015-12-27T12:46:42.370 回答