[SERVER-24208] Use boost::none instead of boost::none_t() Created: 19/May/16  Updated: 08/Jul/16  Resolved: 21/May/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 3.2.6
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Antoine Poliakov Assignee: Andrew Morrow (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-24950 Core Compile Fails Against Boost v1.61.0 Closed
Sprint: Platforms 15 (06/03/16)
Participants:

 Description   

MongoDB doesn't build with recent versions of boost (1.60 here), when using --use-system-boost because of changes in boost::optional. Indeed, boost::none_t is not default constructible anymore, so boost::none_t() doesn't compile anymore. See also: http://www.boost.org/doc/libs/release/boost/none.hpp

There are several options to work around this issue:

  • use the boost::none constant
  • use the more verbose {boost::none_t(boost::none_t::init_tag())}
  • define {BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE}

    globally and continue using

    {boost::none_t()}

find -type f -iname '*.[ch]*' -exec sed -e "s/boost::none_t()/boost::none/" -i {} \;

seems to fix the issue.



 Comments   
Comment by Antonio Malcolm [ 08/Jul/16 ]

Not sure it's worth anything, but I'd like to toss in a vote for updating 3.2.* with one of the aforementioned workarounds, considering it's the current stable (3.2.7, per the MongoDB website),
and Boost 1.59 is now a year old. 1.60 was released in December 2015, 1.61 is the current version, and this fix would add support for both versions.

Also worthy of mention, it's only three source files which need the update, with a combined instances of 4:
src/mongo/db/ftdc/compressor.cpp
src/mongo/db/ftdc/compressor_test.cpp
src/mongo/db/ftdc/file_writer.cpp

Many of us are on *nix systems, and enjoy the benefit of shared libs, rather than using bundled libs, which introduces needless redundancy.
In fact, that's probably the 2nd biggest advantage of compiling (second to cherry-picking features), vs simply downloading a binary.
Adding these changes, while preserving backward compatibility, seems trivial, and it seems odd that you wouldn't want to provide this.

Comment by Andrew Morrow (Inactive) [ 21/May/16 ]

Hi antoinep92 - Please note that we don't make any assurances that any branch (in particular stable branches) will work with system boost of any particular version. That is why we vendor a copy of boost. You are free to locally patch, but we are unlikely to backport support for boost 1.60 to the 3.2 branch.

Comment by Mark Benvenuto [ 19/May/16 ]

Yes, we migrated our internal copy to boost 1.6.0 and noticed the same problem. In master, the commit that fixes this is here: https://github.com/mongodb/mongo/commit/92c3f80f384d2825efeabd0d26aa534c0deb6988.

Generated at Thu Feb 08 04:05:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.