<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:14:57 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-2347] mongo-cxx-driver and visual studio 2017 and vcpkg</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2347</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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 &lt;br/&gt;
compiler options. When I do this the same code generates an error when a document is added to the database using the insert_one(). I believe the &lt;br/&gt;
error is thrown in the bson.c file. My question is I do not think the compiler settings for my project should really effect this library. I &lt;br/&gt;
need my main project to use the Struct Member Alignment of 1 since it passed Struct over the network wire to other services/programs which rely on&lt;br/&gt;
packed data so it would be very hard to change that.&lt;/p&gt;</description>
                <environment>Windows 10 Professional  and Visual Studio 2017 and vcpkg</environment>
        <key id="454943">CDRIVER-2347</key>
            <summary>mongo-cxx-driver and visual studio 2017 and vcpkg</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="marcus">Mark Hodge</reporter>
                        <labels>
                    </labels>
                <created>Mon, 6 Nov 2017 15:09:15 +0000</created>
                <updated>Fri, 27 Oct 2023 13:14:19 +0000</updated>
                            <resolved>Thu, 7 Dec 2017 19:47:25 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="1745885" author="jesse" created="Thu, 7 Dec 2017 19:47:25 +0000"  >&lt;p&gt;Closing for now, please feel free to reopen if you&apos;ve investigated and determined that there is a reproducible bug in libbson.&lt;/p&gt;</comment>
                            <comment id="1740096" author="jesse" created="Fri, 1 Dec 2017 16:14:15 +0000"  >&lt;p&gt;I don&apos;t think &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-596&quot; title=&quot;Figure out what to do about bson_t alignment restrictions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-596&quot;&gt;&lt;del&gt;CDRIVER-596&lt;/del&gt;&lt;/a&gt; is very closely related: that bug is a question about using the compiler&apos;s default alignment versus explicitly setting the alignment of each libbson struct type. This bug is a question about setting the compiler&apos;s alignment to 1 byte.&lt;/p&gt;

&lt;p&gt;I&apos;m sorry to say we don&apos;t have time right now to try to reproduce this issue and debug it with you. I have a couple suggestions:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Try recompiling libbson and libmongoc with /Zp1 and then link your program to them.&lt;/li&gt;
	&lt;li&gt;In libbson&apos;s CMakeLists.txt try replacing &quot;set (BSON_EXTRA_ALIGN 1)&quot; with &quot;set (BSON_EXTRA_ALIGN 0)&quot;? I&apos;m just curious what effect that has.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="1739393" author="marcus" created="Fri, 1 Dec 2017 14:02:12 +0000"  >&lt;p&gt;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.&lt;/p&gt;
</comment>
                            <comment id="1731104" author="jesse" created="Mon, 20 Nov 2017 22:36:41 +0000"  >&lt;p&gt;Hi, if you need to set the alignment of some structs that represent network messages, please align only those structs:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;typedef __declspec( align( 1 ) ) _my_struct {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    int field1;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    char field2;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;} my_struct;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Do that only for the structs you must set the alignment of, and leave the overall alignment of the code set to the default.&lt;/p&gt;

&lt;p&gt;For more info:&lt;br/&gt;
&lt;a href=&quot;https://msdn.microsoft.com/en-us/library/83ythb65.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://msdn.microsoft.com/en-us/library/83ythb65.aspx&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1719134" author="derick" created="Tue, 7 Nov 2017 12:32:47 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=marcus&quot; class=&quot;user-hover&quot; rel=&quot;marcus&quot;&gt;marcus&lt;/a&gt;, 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: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-596&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CDRIVER-596&lt;/a&gt;, which also introduces a workaround that might work for you: Compiling the C driver with an extra flag. I&apos;ll let the C driver team decide on whether this could be a duplicate, or a new issue.&lt;/p&gt;</comment>
                            <comment id="1717657" author="marcus" created="Mon, 6 Nov 2017 15:53:09 +0000"  >&lt;p&gt;I have added a screen capture of the exception i hope that helps.&lt;/p&gt;

&lt;p&gt;seems to be saying in bson_init_static in bson.c    on the memcpy that is in that routine an exception &amp;lt;Error reading characters of string&amp;gt;.  As I say does not seem to happen when  default alignment is used. only happens it seems with /Zp1 and /Zp2&lt;br/&gt;
 works ok with /Zp4 and /Zp8 and /Zp16 and the default setting.&lt;/p&gt;
</comment>
                            <comment id="1717628" author="derick" created="Mon, 6 Nov 2017 15:39:33 +0000"  >&lt;p&gt;Can you share the full error message please?&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="170253" name="codecrash.jpg" size="152439" author="marcus" created="Mon, 6 Nov 2017 15:48:02 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htb49r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>