[SERVER-5561] Move definition of BOOST_FILESYSTEM_VERSION preprocessor constant out of pch.h Created: 10/Apr/12 Updated: 11/Jul/16 Resolved: 23/Oct/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | None |
| Fix Version/s: | 2.3.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Andy Schwerin | Assignee: | Andy Schwerin |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
The redefinition of BOOST_FILESYSTEM_VERSION 2 in pch.h makes it problematic if you are using version 3 in userland code. |
| Comments |
| Comment by Andy Schwerin [ 23/Oct/12 ] |
|
Resolved by |
| Comment by Pedro Larroy [ 18/Apr/12 ] |
|
I think the best solution is just using v3. For future releases you could just require boost with BFSv3. I'm afraid this won't work. Currently in my organization we were also using BFSv2 and we migrated to BFSv3 and removed this very macro. The surprise came when the mongodb driver was redefining this macro when including the client headers and thus making it incompatible. IIRC if the macro is not defined, the old API is not exported. As I understand this issue both APIS are mutually exclusive. Even worse, changing like: — a/SConstruct -env.Prepend( CPPDEFINES=[ "_SCONS" , Will break boost compilation as the environment is inherited. generate_buildinfo(["build/buildinfo.cpp"], ['\n#include <string>\n#include <boost/version.hpp>\n\n#include "mongo/util/version.h"\n\nnamespace mongo {\n const char * gitVersion() { return "%(git_version)s"; }\n std::string sysInfo() { return "%(sys_info)s BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; }\n} // namespace mongo\n']) |
| Comment by Andy Schwerin [ 16/Apr/12 ] |
|
When I filed this bug, I didn't intend to upgrade Mongo to using the v3 version of boost::filesystem; only to insulate consumers of the C++ driver from Mongo's choice of version. The straight upgrade approach that you propose may interfere with organizations that require dynamic linking and boost versions prior to 1.44. Clearly, sticking to the v2 interface will be untenable in the future, however. Anyhow, I have not forgotten this patch, but have not had time to consider these implications, fully. If you have time to experiment, could you see if defining BOOST_FILESYSTEM_VERSION=2 in the SCons CPPDEFINES variable and dropping it from pch.h provides a version of the C++ driver compatible with applications that also need v3 of boost::filesystem? If not, I will look into it when I have time. |
| Comment by Pedro Larroy [ 16/Apr/12 ] |
|
Hi Andy, did you had time to look at this pull request? regards. |
| Comment by Pedro Larroy [ 10/Apr/12 ] |
|
Hi I created a pull request: https://github.com/mongodb/mongo/pull/208 |