Error when building Mongodb on ubuntu server

1.7k views Asked by At

I am trying to build mongodb (r2.4.8) with the --ssl option on a ubuntu server (13.10)

I get these errors:

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.

These are just a few errors from the error list...

What am I doing wrong ?

Thanks

2

There are 2 answers

1
Antony Woods On BEST ANSWER

This actually looks like a bug in boost when compiled with GCC4.8. I recently upgraded to 13.10 (desktop) and started having this exact same issue. Sure enough...

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

Googled around a bit and found this:

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

Easy fix is to compile with -Wno-unused-local-typedefs, which you can add to the scons file.

5
sehe On

Simplest way:

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

You can actually trivially compile the debian package from source with a single statement:

apt-get source --compile mongodb

This tells you what Debian developers have figures out to be the required dependencies. 90% of the time this makes it quick to locate the missing bits for me