[CDRIVER-2347] mongo-cxx-driver and visual studio 2017 and vcpkg Created: 06/Nov/17 Updated: 27/Oct/23 Resolved: 07/Dec/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Mark Hodge | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10 Professional and Visual Studio 2017 and vcpkg |
||
| Attachments: |
|
| Description |
|
I installed the mongo-cxx-driver with the vcpkg successfully and made a new project with Visual Studio 2017 for a Visual C++ console application. I am running with Windows 10 Professional version. I compiled the test sample from the Mongo web site and it all worked perfectly - so great so far. I then for my project need to change the default compiler settings to use Struct Member Alignment of 1 byte which is the /Zp1 setting on the |
| Comments |
| Comment by A. Jesse Jiryu Davis [ 07/Dec/17 ] | ||||
|
Closing for now, please feel free to reopen if you've investigated and determined that there is a reproducible bug in libbson. | ||||
| Comment by A. Jesse Jiryu Davis [ 01/Dec/17 ] | ||||
|
I don't think I'm sorry to say we don't have time right now to try to reproduce this issue and debug it with you. I have a couple suggestions:
| ||||
| Comment by Mark Hodge [ 01/Dec/17 ] | ||||
|
I realize I could set the alignment of the structures in my code via the #pragma or as above - the only problem is there is a lot of legacy code that is using the packed /Zp1 flag. I will do that though if no other solution can be found. Was the issue that Derick pointed out related to this since I see that that issue has been resolved, or is there any other work arounds by including the mongo libraries in some other fashion - presently I am using the vcpkg from microsoft to install it for Visual Studio 2017. | ||||
| Comment by A. Jesse Jiryu Davis [ 20/Nov/17 ] | ||||
|
Hi, if you need to set the alignment of some structs that represent network messages, please align only those structs:
Do that only for the structs you must set the alignment of, and leave the overall alignment of the code set to the default. For more info: | ||||
| Comment by Derick Rethans [ 07/Nov/17 ] | ||||
|
Hi marcus, I have moved this over to the CDRIVER project, as it seems that this is where the error is. In the past we have had other issues with alignment: https://jira.mongodb.org/browse/CDRIVER-596, which also introduces a workaround that might work for you: Compiling the C driver with an extra flag. I'll let the C driver team decide on whether this could be a duplicate, or a new issue. | ||||
| Comment by Mark Hodge [ 06/Nov/17 ] | ||||
|
I have added a screen capture of the exception i hope that helps. seems to be saying in bson_init_static in bson.c on the memcpy that is in that routine an exception <Error reading characters of string>. As I say does not seem to happen when default alignment is used. only happens it seems with /Zp1 and /Zp2 | ||||
| Comment by Derick Rethans [ 06/Nov/17 ] | ||||
|
Can you share the full error message please? |