Bug 216213 - databases/mongodb: fails to build with clang 4.0 (3 ports skipped)
Summary: databases/mongodb: fails to build with clang 4.0 (3 ports skipped)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: patch
: 220857 (view as bug list)
Depends on:
Blocks: 216008
  Show dependency treegraph
 
Reported: 2017-01-18 08:23 UTC by Jan Beich
Modified: 2017-07-20 09:41 UTC (History)
4 users (show)

See Also:


Attachments
mongodb.diff (4.54 KB, patch)
2017-03-15 13:02 UTC, Tobias Kortkamp
tobik: maintainer-approval? (ale)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-01-18 08:23:13 UTC
In file included from src/mongo/db/fts/fts_command.cpp:35:
In file included from src/mongo/db/fts/fts_util.h:37:
In file included from src/mongo/db/storage/record.h:35:
In file included from src/mongo/db/storage/extent.h:34:
src/mongo/db/structure/catalog/namespace.h:58:65: error: ordered comparison between pointer and zero ('const char *' and 'int')
        bool hasDollarSign() const { return strchr( buf , '$' ) > 0;  }
                                            ~~~~~~~~~~~~~~~~~~~ ^ ~
In file included from src/mongo/s/shard.cpp:33:
In file included from src/mongo/s/shard.h:35:
src/mongo/client/connpool.h:326:40: error: ordered comparison between pointer and zero ('mongo::DBClientBase *' and 'int')
        bool ok() const { return _conn > 0; }
                                 ~~~~~ ^ ~
In file included from src/mongo/s/shard.cpp:33:
src/mongo/s/shard.h:295:40: error: ordered comparison between pointer and zero ('mongo::DBClientBase *' and 'int')
        bool ok() const { return _conn > 0; }
                                 ~~~~~ ^ ~
In file included from src/mongo/db/dbcommands_generic.cpp:44:
In file included from src/mongo/db/db.h:33:
src/mongo/db/client.h:263:59: error: ordered comparison between pointer and zero ('mongo::Client *' and 'int')
    inline bool haveClient() { return currentClient.get() > 0; }
                                      ~~~~~~~~~~~~~~~~~~~ ^ ~

build log: http://sprunge.us/gicD
regressed by: https://github.com/llvm-mirror/clang/commit/4b6ad14285f3
Comment 1 Tobias Kortkamp freebsd_committer 2017-03-15 13:02:32 UTC
Created attachment 180846 [details]
mongodb.diff

Just ran into this when trying to build mongodb on 12.0-CURRENT.  With
a couple of patches mongodb can build again.

When building with LibreSSL there is an additional build failure:

build/freebsd/cc_cc/cxx_c++/ssl/use-system-pcre/use-system-snappy/use-system-v8/mongo/util/net/ssl_manager.o: In function `mongo::_mongoInitializerFunction_SSLManager(mongo::InitializerContext*)':
src/mongo/util/net/ssl_manager.cpp:(.text+0x35b): undefined reference to `FIPS_mode_set'

SConstruct checks for FIPS_mode_set (which base's OpenSSL has but
LibreSSL does not have) with base's OpenSSL in the include path and
incorrectly defines MONGO_HAVE_FIPS_MODE_SET.
Comment 2 Jan Beich freebsd_committer 2017-03-15 14:58:51 UTC
Comment on attachment 180846 [details]
mongodb.diff

> +post-patch-SSL-on:
> +.if ${SSL_DEFAULT:Mlibressl*}
> +	@${REINPLACE_CMD} 's/\([ ]*\).*MONGO_HAVE_FIPS_MODE_SET.*/\1pass/' \
> +		${WRKSRC}/SConstruct
> +.endif

I can't reproduce but maybe add USES+=localbase to fix SCons check instead.

> +-        bool ok() const { return _conn > 0; }
> ++        bool ok() const { return _conn != nullptr; }

GCC before 6.0 defaults to -std=gnu++98 but libc++ often leaks C++11 surrogates. Better take advantage of base r228918 instead.

In file included from src/mongo/s/shard.h:35:0,
                 from src/mongo/s/balancer_policy.h:37,
                 from src/mongo/s/balancer_policy.cpp:34:
src/mongo/client/connpool.h:326:9: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
         bool ok() const { return _conn != nullptr; }
         ^
src/mongo/client/connpool.h: In member function 'virtual bool mongo::ScopedDbConnection::ok() const':
src/mongo/client/connpool.h:326:43: error: 'nullptr' was not declared in this scope
         bool ok() const { return _conn != nullptr; }
                                           ^
Comment 3 Thomas Zander freebsd_committer 2017-04-30 14:04:14 UTC
Ping
Comment 4 commit-hook freebsd_committer 2017-07-20 09:14:32 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jul 20 09:14:17 UTC 2017
New revision: 446250
URL: https://svnweb.freebsd.org/changeset/ports/446250

Log:
  databases/mongodb: unbreak with clang >= 4.0

  Convert ptr > 0 to ptr != 0. As semantics are similar no need for
  PORTREVISION bump.

  PR:		216213 220857
  Submitted by:	tobik (based on)
  Approved by:	maintainer timeout (4 months) + portmgr blanket
  Obtained from:	upstream (still under APACHE-2.0)

Changes:
  head/databases/mongodb/Makefile
  head/databases/mongodb/distinfo
Comment 5 Jan Beich freebsd_committer 2017-07-20 09:16:36 UTC
@tobik, thanks for the ping but you didn't respond to my review thus timeout. I've also found an upstream fix which seems to coincide with my opinion on NULL vs. nullptr.
Comment 6 commit-hook freebsd_committer 2017-07-20 09:18:38 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jul 20 09:17:33 UTC 2017
New revision: 446252
URL: https://svnweb.freebsd.org/changeset/ports/446252

Log:
  MFH: r446250

  databases/mongodb: unbreak with clang >= 4.0

  Convert ptr > 0 to ptr != 0. As semantics are similar no need for
  PORTREVISION bump.

  PR:		216213 220857
  Submitted by:	tobik (based on)
  Approved by:	maintainer timeout (4 months) + portmgr blanket
  Obtained from:	upstream (still under APACHE-2.0)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q3/
  branches/2017Q3/databases/mongodb/Makefile
  branches/2017Q3/databases/mongodb/distinfo
Comment 7 Jan Beich freebsd_committer 2017-07-20 09:20:01 UTC
*** Bug 220857 has been marked as a duplicate of this bug. ***
Comment 8 commit-hook freebsd_committer 2017-07-20 09:21:45 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jul 20 09:21:03 UTC 2017
New revision: 446253
URL: https://svnweb.freebsd.org/changeset/ports/446253

Log:
  MFH: r446250

  databases/mongodb: unbreak with clang >= 4.0

  Convert ptr > 0 to ptr != 0. As semantics are similar no need for
  PORTREVISION bump.

  PR:		216213 220857
  Submitted by:	tobik (based on)
  Approved by:	maintainer timeout (4 months) + portmgr blanket
  Obtained from:	upstream (still under APACHE-2.0)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q2/
  branches/2017Q2/databases/mongodb/Makefile
  branches/2017Q2/databases/mongodb/distinfo