[CXX-1286] building mongodbcxx on Windows Created: 24/Mar/17 Updated: 06/Apr/17 Resolved: 06/Apr/17 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Seungwon Yoon | Assignee: | J Rassi |
| Resolution: | Done | Votes: | 0 |
| Labels: | Bug | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10, MSVS 2015 Update 3, mongodbcxx master branch |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
I installed mongodbcxx using following command
Then I did msbuild.exe ALL_BUILD.vcxproj to build the MSVS project file which resulted in 327 errors. One of errors was
so I added #include <assert.h> to mock.hh and errors were reduced down to 80. The rest has to do with bsoncxx and I was wondering if I could get any help. Attached the command prompt error message as txt file |
| Comments |
| Comment by J Rassi [ 06/Apr/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
ysw0927: nope, I'll close this ticket now. Glad you were able to successfully build the driver! The information and logs you've provided already were quite helpful, thank you. I've filed CXX-1295 to improve the user experience when running CMake with the wrong generator on Windows. | |||||||||||||||||||||||||||||||||||||||||
| Comment by David Golden [ 06/Apr/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
The "assert" problem looks like a duplicate of | |||||||||||||||||||||||||||||||||||||||||
| Comment by Seungwon Yoon [ 06/Apr/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
My apology, something else had me caught up for last several days. Same thing from above, I was getting this error:
So I added #include <assert.h> for mock.hh and yes, I was finally able to build the driver successfully. I appreciate your help. Do you want me to post anything else before the ticket gets closed? | |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 06/Apr/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Hi ysw0927, just following up on this ticket. Were you able to build the driver successfully build after compiling from a clean build directory? | |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 03/Apr/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Hmm, the vcxproj files from the build.zip archive you uploaded now look correct: the ClCompile sections now say "<ExceptionHandling>Sync</ExceptionHandling>" instead of "<ExceptionHandling></ExceptionHandling>". Can you re-try a full build from this build directory, with "MSBuild.exe ALL_BUILD.vcxproj"? If this works now, then I wonder if the issue was just that some data in the CMake cache (like CMAKE_CXX_FLAGS, which is now "/DWIN32 /D_WINDOWS /W3 /GR /EHsc" as expected) was out-of-date after you switched CMake generators, and that clearing this cached data was the necessary fix. | |||||||||||||||||||||||||||||||||||||||||
| Comment by Seungwon Yoon [ 02/Apr/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
For cmake, I just downloaded MSI from the website. Here is the command that I ran from C:\Users\SynchroGrid\Desktop\mongo-cxx-driver-releases-stable\build:
Attached the output as cmake_compile_output.txt as well as .zip of build folder. It looks like we work in different time zones but I appreciate that you keep in touch. | |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 31/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Indeed, I can confirm your CMake-generated vcxproj file has "<ExceptionHandling></ExceptionHandling>" directives, whereas I'd expect them to have "<ExceptionHandling>Sync</ExceptionHandling>" directives. There's a couple of other suspicious things about the vcxproj file, too: I notice that it doesn't list "WIN32" or "_WINDOWS" in the "PreprocessorDefinitions" directive, for example. Thanks also for the CMake version information. I'm unable to reproduce with the same version, so it has to be something else. I have two more requests for information:
Thanks for your patience! | |||||||||||||||||||||||||||||||||||||||||
| Comment by Seungwon Yoon [ 31/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Thanks for the help. I uploaded mongocxx.vcxproj and this is the cmake verision:
| |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 31/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Actually, nevermind my question above. I realize that the build output you posted describes the issue in a warning when compiling that source file: "warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc". Indeed, I can reproduce this issue when I manually remove /EHsc from my compile line. I generally would expect CMake's Visual Studio generator to generate an <ExceptionHanding> block for the relevant project file that translates into /EHsc on the compile line, though. Could you upload C:\Users\SynchroGrid\Desktop\mongo-cxx-driver-releases-stable\build\src\mongocxx\mongocxx.vcxproj as an attachment to this ticket? And also post the output of running "cmake --version"? Thanks. | |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 31/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Thanks for the additional information. Could you please download the attached patch "experiment.diff", apply the patch with "git apply experiment.diff", attempt to compile again, and paste in the new set of errors? The patch adds some additional static assertions, and the results will hopefully will shed light on whether the issue is with mongocxx, Boost, MSVC, or something else. | |||||||||||||||||||||||||||||||||||||||||
| Comment by Seungwon Yoon [ 30/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Added output of cmake, output of ALL_BUILD, and version of msbuild.exe. Also I tried CL.exe but It's not a recognized command. | |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 28/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Hmm. It appears that your compiler evaluates std::is_nothrow_move_constructible<T>::value to false for the model types, which is unexpected. I attempted to reproduce this issue with VS2015 Update 3 and Boost 1.63, but the issue did not reproduce for me. I'll need additional information to help further the diagnosis of your problem. Could you please post:
Thanks. | |||||||||||||||||||||||||||||||||||||||||
| Comment by Seungwon Yoon [ 28/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Thanks for that solution. It got rid of the errors I mentioned above but now I am getting different errors.
It's same type of error from this issue The reporter in that case was able to fix by updating boost library but I already have boost 1.63.0 which is the latest version. What could possibly cause this in my case? Following is the command I used for compilation:
| |||||||||||||||||||||||||||||||||||||||||
| Comment by J Rassi [ 26/Mar/17 ] | |||||||||||||||||||||||||||||||||||||||||
|
Hi there. Sorry to hear you're having trouble building mongocxx. I noticed this warning in your build output: "warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'". This makes me suspect that you have an x64 libmongoc, but the linker is expecting to find an X86 library providing libmongoc symbols. Could you try adding -G "Visual Studio 14 2015 Win64" to your cmake invocation, and perform a clean build? The default generator for cmake on Windows will often be Visual Studio 14 2015 (without the "Win64"), which generates X86 output by default. |