Bug 224821

Summary: databases/mongodb36: fails to build with boost 1.66
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: dev, monder, weishan.ang
Priority: --- Keywords: needs-patch
Version: LatestFlags: jbeich: maintainer-feedback? (dev)
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224090
Bug Depends on:    
Bug Blocks: 223922    
Description Flags
mongodb 3.6.1 with boost fix
3.6.1 update
3.6.2 update
3.6.2 with Boost 1.66 build fix
3.6.2, boost 1.66 fix none

Description Jan Beich freebsd_committer 2018-01-01 17:11:23 UTC
As part of exp-run in bug 223922 this port was found to break on Boost update. If the issue won't disappear on its own on update I plan to mark the port as BROKEN. Can you check with upstream maintainer or help with a fix?

$ fetch -qo- 'https://reviews.freebsd.org/D13279?download=true' | patch -Efsp0 -d /usr/ports
$ make all deinstall install clean -C/usr/ports/devel/boost-libs
$ make -C/usr/ports/databases/mongodb36
src/mongo/db/repl/oplog_fetcher.cpp:248:22: error: no matching function for call to 'make_optional'
        oqMetadata = boost::make_optional<rpc::OplogQueryMetadata>(metadataResult.getValue());
/usr/local/include/boost/optional/optional.hpp:1367:56: note: candidate function not viable: no known conversion from 'mongo::rpc::OplogQueryMetadata' to 'mongo::rpc::OplogQueryMetadata &&' for 1st argument
optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type> make_optional ( T && v  )
/usr/local/include/boost/optional/optional.hpp:1375:56: note: candidate function template not viable: requires 2 arguments, but 1 was provided
optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type> make_optional ( bool cond, T && v )
1 error generated.

Build logs:
10.3 amd64 - https://clbin.com/BVY2k
11.1 amd64 - https://clbin.com/ZTmR6
12.0 amd64 - https://clbin.com/n0al6
Comment 1 dev 2018-01-03 09:10:05 UTC
Hi Jan, does it pass if you remove --use-system-boost from the port Makefile?
Comment 2 Jan Beich freebsd_committer 2018-01-03 10:33:49 UTC
Yep, see build log: https://clbin.com/datJ2
Comment 3 dev 2018-01-03 15:06:17 UTC
(In reply to Jan Beich from comment #2)
Thanks Jan,

I'm in two minds about using the in-tree boost for building mongo, as it goes against the guidelines for building ports. OTOH it would ensure the port builds fine regardless of the version of boost installed.

I don't have a super flexible testbed at the moment, I would need to wait until 1.66 is rolled out to ports before I can fix the mongo port. What is the timeline for that? I can then fix mongo along with the bump to 3.6.1.

Comment 4 Jan Beich freebsd_committer 2018-01-03 15:40:36 UTC
(In reply to dev from comment #3)
> goes against the guidelines for building ports

Bundled libs should be fine as a temporary workaround, see bug 207982, bug 218841 + bug 222439. Boost rarely has vulnerabilites unlike cURL or FFmpeg.

> What is the timeline for that?

Bug 223922 had only 1 exp-run[1], it's 1 month old and against Beta 1 (not release). I need one more to check there're no more bustage, file bugs if not and mark the affected ports as BROKEN, so maintainers/users know why/when. After that is landing while bumping PORTREVISION in ~350 consumers.

[1] check https://pkg-status.freebsd.org/builds?setname=PR223922 or wait for antoine@ to reply in that bug
Comment 5 dev 2018-01-08 11:55:21 UTC
Created attachment 189510 [details]
mongodb 3.6.1 with boost fix

Patch to fix the build using the in-tree Boost. Also upgrades mongodb to 3.6.1.
Comment 6 dev 2018-01-10 08:29:42 UTC
I'll wait for Boost 1.66 to land, at which point I'll fix the port to use it. Thanks Jan.
Comment 7 Jan Beich freebsd_committer 2018-01-10 11:56:27 UTC
Comment on attachment 189510 [details]
mongodb 3.6.1 with boost fix

- Drop boost-libs from LIB_DEPENDS as you're using bundled Boost
- Maybe add a comment before MAKE_ARGS line about Boost issue:
  # Bug 224821: use bundled boost 1.60 to avoid 1.66 bustage
- Update to 3.6.1 better merge with the patch in bug 224303
Comment 8 dev 2018-01-10 12:16:15 UTC
Created attachment 189586 [details]
3.6.1 update
Comment 9 dev 2018-01-10 12:16:45 UTC
(In reply to Jan Beich from comment #7)

Good catch, thanks Jan, I knew I'd forgotten something. New patch uploaded.
Comment 10 dev 2018-01-11 15:30:30 UTC
Created attachment 189617 [details]
3.6.2 update
Comment 11 dev 2018-01-18 13:11:36 UTC
Created attachment 189885 [details]
3.6.2 with Boost 1.66 build fix
Comment 12 dev 2018-01-20 09:27:38 UTC
Created attachment 189929 [details]
3.6.2, boost 1.66 fix
Comment 13 dev 2018-02-02 01:16:40 UTC
Can this be merged then? The Mongo team applied the same patch as I did.
Comment 14 Jan Beich freebsd_committer 2018-02-02 09:46:04 UTC
Comment on attachment 189929 [details]
3.6.2, boost 1.66 fix

(In reply to Vlad Galu from comment #13)
> Can this be merged then?

databases/mongodb36 currently doesn't exist.

>  LIB_DEPENDS=	libpcre.so:devel/pcre \
> -		libsnappy.so:archivers/snappy \
> -		libboost_system.so:devel/boost-libs
> +		libboost_system.so:devel/boost-libs \
> +		libsnappy.so:archivers/snappy

Please, sort by port origin/directory or just drop patch churn.

> ---- SConstruct.orig	2017-12-01 17:04:06 UTC
> +--- SConstruct.orig	2018-01-04 23:28:55 UTC
> ---- rpm/mongod.conf.orig	2017-12-01 17:04:06 UTC
> +--- rpm/mongod.conf.orig	2018-01-04 23:28:55 UTC

Unless context lines or offsets have changed this only introduces patch churn.

> +-        oqMetadata = boost::make_optional<rpc::OplogQueryMetadata>(metadataResult.getValue());
> ++        oqMetadata = boost::optional<rpc::OplogQueryMetadata>(metadataResult.getValue());

Why is this different from https://github.com/mongodb/mongo/commit/3c34eda8d8a3 ?
Comment 15 dev 2018-02-02 09:57:44 UTC
(In reply to Jan Beich from comment #14)

Ah OK, the pending PR for the mongodb36 port hasn't gone in yet. I'll update that instead again. The Mongo patch is functionally equivalent, but I'll incorporate the official patch anyway and clean up the port.

Comment 16 Jan Beich freebsd_committer 2018-02-14 05:39:22 UTC
ports r461011 picked up upstream fix via svn copy from mongodb34.