[SERVER-14930] error: 'swap' is not a member of 'std' Created: 18/Aug/14  Updated: 21/Mar/15  Resolved: 21/Mar/15

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 2.6.4
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ryan Schmidt Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

On Mac OS X 10.6, install MacPorts, then run "sudo port -d install mongodb"

Participants:

 Description   

Hello, I'm the maintainer of MongoDB in the MacPorts package management system. MongoDB 2.6.4 does not build on Mac OS X 10.6:

/usr/bin/g++-4.2 -o build/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/mongo/shell/linenoise.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -pipe -Werror -O3 -m64 -Wno-unused-function -Wno-deprecated-declarations -mmacosx-version-min=10.6 -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -DMONGO_OPTIMIZED_BUILD -D_FILE_OFFSET_BITS=64 -DBOOST_THREAD_VERSION=2 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8 -Isrc -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/mongo -Isrc/mongo -I/Volumes/Data/macports/snowleopard/include -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/third_party/v8/include -Isrc/third_party/v8/include -Ibuild/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/third_party/yaml-cpp-0.5.1/include -Isrc/third_party/yaml-cpp-0.5.1/include src/mongo/shell/linenoise.cpp
In file included from src/mongo/shell/linenoise.cpp:116:
src/mongo/shell/linenoise_utf8.h: In member function 'void linenoise_utf8::UtfStringMixin<char_type>::swap(linenoise_utf8::UtfStringMixin<char_type>&)':
src/mongo/shell/linenoise_utf8.h:145: error: 'swap' is not a member of 'std'
src/mongo/shell/linenoise_utf8.h:146: error: 'swap' is not a member of 'std'
src/mongo/shell/linenoise_utf8.h:147: error: 'swap' is not a member of 'std'
scons: *** [build/darwin/64/cc__usr_bin_gcc-4.2/cxx__usr_bin_g++-4.2/use-system-boost/use-system-pcre/use-system-snappy/usev8/mongo/shell/linenoise.o] Error 1
scons: building terminated because of errors.

2.6.3 did build on this system.



 Comments   
Comment by Adam Midvidy [ 21/Mar/15 ]

Great. Glad to hear that.

Comment by Ryan Schmidt [ 21/Mar/15 ]

Yes, I did switch mongodb in MacPorts back to using the "system" (i.e. MacPorts) boost as of mongodb 3.0 and it seems to work fine.

Comment by Adam Midvidy [ 20/Mar/15 ]

Hi Ryan,

I see that macports now provides MongoDB 3.0.1. As we made some changes in the 3.0 development cycle to support building against Boost 1.56 I would hope that this problem has been resolved. Can you confirm if macports can successfully build MongoDB with -use-system-boost and Boost 1.56?

Best,
Adam

Comment by Ryan Schmidt [ 27/Jan/15 ]

Yes, the problem remains with mongodb 2.6.7 on OS X 10.6.8 if I use --use-system-boost, where the system boost is 1.57.0. I will try adding #include <algorithm>.

Comment by Matt Kangas [ 24/Jan/15 ]

ryandesign, are you still able to reproduce this on any system you have access to?

My prior comment about boost seems to be a red herring. I suspect this a "include what you use" violation in linenoise_utf8.h introduced in commit fc923db. std::swap requires the header <algorithm>.

Comment by Matt Kangas [ 18/Aug/14 ]

I'm surprised to hear that Boost 1.56 worked for you at all. We have found several incompatibilities and we're ironing them out currently in SERVER-8994.

Comment by Ryan Schmidt [ 18/Aug/14 ]

Thanks, I'll try without --use-system-boost later.

Yes, I did update MacPorts boost from 1.55.0 to 1.56.0 shortly before updating mongodb from 2.6.3 to 2.6.4. Note that mongodb 2.6.4 builds fine with boost 1.56.0 on OS X 10.9, but not on 10.8, 10.7 or 10.6.

Using system boost is desirable as explained here last time we changed this: https://trac.macports.org/ticket/38334

Comment by Matt Kangas [ 18/Aug/14 ]

Hi ryandesign,

I see you're using the --use-system-boost option. Can you try building without that?

The lines you are seeing a compile failure on have not changed since 2012, nor have the includes for this file.
https://github.com/mongodb/mongo/blame/v2.6/src/mongo/shell/linenoise_utf8.h#L144-L149

Perhaps your system boost version has changed since you last built 2.6.3 on this system?

Comment by Ryan Schmidt [ 18/Aug/14 ]

Sorry, apparently I don't understand your issue tracker's formatting syntax.

Generated at Thu Feb 08 03:36:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.