【问题标题】:Error when building Mongodb on ubuntu server在 ubuntu 服务器上构建 Mongodb 时出错
【发布时间】:2013-12-07 16:10:50
【问题描述】:

我正在尝试在 ubuntu 服务器 (13.10) 上使用 --ssl 选项构建 mongodb (r2.4.8)

我收到以下错误:

scons --ssl --64 all

src/third_party/boost/boost/date_time/posix_time/posix_time_io.hpp: In function 'std::basic_ostream<_CharT, _Traits>& boost::posix_time::operator<<(std::basic_ostream<_CharT, _Traits>&, const boost::posix_time::time_duration&)':
src/third_party/boost/boost/date_time/posix_time/posix_time_io.hpp:183:51: error: typedef 'std_ptime_facet' locally defined but not used [-Werror=unused-local-typedefs]
     typedef std::time_put<CharT>                  std_ptime_facet;
                                                   ^
In file included from src/third_party/boost/boost/config.hpp:57:0,
                 from src/third_party/boost/boost/smart_ptr/shared_ptr.hpp:17,
                 from src/third_party/boost/boost/shared_ptr.hpp:17,
                 from src/mongo/pch.h:48,
                 from src/mongo/shell/dbshell.cpp:18:
src/mongo/db/../bson/bsonobjbuilder.h: In member function 'void mongo::BSONArrayBuilder::fill(int)':
src/third_party/boost/boost/static_assert.hpp:125:21: error: typedef 'boost_static_assert_typedef_836' locally defined but not used [-Werror=unused-local-typedefs]
          BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
                     ^
src/mongo/db/../bson/bsonobjbuilder.h:836:13: note: in expansion of macro 'BOOST_STATIC_ASSERT'
             BOOST_STATIC_ASSERT(maxElems < (BSONObjMaxUserSize/10));
             ^
In file included from src/third_party/boost/boost/filesystem/v3/path_traits.hpp:23:0,
                 from src/third_party/boost/boost/filesystem/v3/path.hpp:25,
                 from src/third_party/boost/boost/filesystem/v3/operations.hpp:25,
                 from src/third_party/boost/boost/filesystem/operations.hpp:31,
                 from src/mongo/shell/dbshell.cpp:20:
src/third_party/boost/boost/system/error_code.hpp: At global scope:
src/third_party/boost/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable]
     static const error_category &  posix_category = generic_category();
                                    ^
src/third_party/boost/boost/system/error_code.hpp:215:36: error: 'boost::system::errno_ecat' defined but not used [-Werror=unused-variable]
     static const error_category &  errno_ecat     = generic_category();
                                    ^
src/third_party/boost/boost/system/error_code.hpp:216:36: error: 'boost::system::native_ecat' defined but not used [-Werror=unused-variable]
     static const error_category &  native_ecat    = system_category();
                                    ^
cc1plus: all warnings being treated as errors
scons: *** [build/linux2/64/ssl/mongo/shell/dbshell.o] Error 1
scons: building terminated because of errors.

这些只是错误列表中的一些错误...

我做错了什么?

谢谢

【问题讨论】:

  • 嗯,在我的笔记本电脑上工作,在构建 mongodb 时,ubuntu 服务器与桌面有什么不同吗?

标签: mongodb ubuntu-server build-error


【解决方案1】:

当使用 GCC4.8 编译时,这实际上看起来像是 boost 中的一个错误。我最近升级到 13.10(桌面)并开始遇到同样的问题。果然……

acron@####:~$ g++ --version
g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1

谷歌了一下,发现了这个:

https://svn.boost.org/trac/boost/ticket/7242

简单的解决方法是使用-Wno-unused-local-typedefs 进行编译,您可以将其添加到 scons 文件中。

【讨论】:

  • 这会放在 SConstruct 文件中吗?文件在哪里?
【解决方案2】:

最简单的方法:

sudo apt-get build-dep mongodb # or monodb-server

您实际上可以通过一条语句从源代码轻松编译 debian 包:

apt-get source --compile mongodb

这会告诉您 Debian 开发人员发现哪些是必需的依赖项。 90% 的时间,这让我可以快速找到丢失的位

【讨论】:

  • 感谢您的回答。我试过这个:apt-get source --compile mongodb,它可以工作。但我仍然无法让 scons --ssl --64 all 在 ubuntu 服务器上工作。仍然得到同样的错误
  • 看起来您使用 -Werror 运行(警告为错误)。也许您的环境中有一个标志(CPPFLAGS?)或 scons 文件?通常,Debian 会修补其软件包中的构建问题。
  • 我从 SConestruct 及其建筑物中删除了 -Werror ... 有一件事, -Werror 不存在是有原因的吗?构建会不稳定吗?
  • @DarkRoast 它不会比它更不稳定。显然,编译器已经变得更加擅长警告未使用的本地人。项目开发人员可能没有为最新的编译器更新他们的代码。如果有什么安慰的话,我会在 -Werror-unused-local-typedefs 上得到很多,只是在最近的 GCC 上编译 Boost。听起来是一样的交易。
  • 好吧,我安装了 mongodb(sudo apt-get install mongodb),然后使用 --ssl 开始构建,现在它可以工作了... apt-get 必须安装了构建所需的一些依赖项.感谢您的所有帮助sehe
猜你喜欢
  • 1970-01-01
  • 2012-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-05
  • 2023-03-26
  • 2020-01-16
  • 1970-01-01
相关资源
最近更新 更多