<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:14:01 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-2054] Windows static build is broken in 1.5.0</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2054</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;As of libmongoc 1.5.0, attempting to link applications against the static build of the driver will fail with the error that symbols like &quot;&amp;#95;&amp;#95;imp_bson_iter_init&quot; and &quot;&amp;#95;&amp;#95;imp_mongoc_read_prefs_new&quot; cannot be resolved.&lt;/p&gt;

&lt;p&gt;Original description:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Linking with bson-static-1.0.lib, mongoc-static-1.0.lib, libbsoncxx.lib, libmongocxx.lib worked in version 3.0.1 but fails with 3.1.0:&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;1&amp;gt;libbsoncxx.lib(view.cpp.obj) : error LNK2001: unresolved external symbol __imp_bson_iter_init&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;1&amp;gt;libbsoncxx.lib(core.obj) : error LNK2001: unresolved external symbol __imp_bson_iter_init&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;1&amp;gt;libbsoncxx.lib(view.cpp.obj) : error LNK2001: unresolved external symbol __imp_bson_iter_init&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;1&amp;gt;libbsoncxx.lib(view.cpp.obj) : error LNK2001: unresolved external symbol __imp_bson_iter_init_find&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;1&amp;gt;libbsoncxx.lib(view.cpp.obj) : error LNK2001: unresolved external symbol __imp_bson_iter_init_find&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;1&amp;gt;libbsoncxx.lib(view.cpp.obj) : error LNK2001: unresolved external symbol __imp_bson_iter_next&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;etc, etc.&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;/blockquote&gt;</description>
                <environment></environment>
        <key id="351868">CDRIVER-2054</key>
            <summary>Windows static build is broken in 1.5.0</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="9">Done</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="rustyx">Rustam Abdullaev</reporter>
                        <labels>
                    </labels>
                <created>Mon, 6 Feb 2017 08:42:13 +0000</created>
                <updated>Wed, 3 May 2017 22:14:38 +0000</updated>
                            <resolved>Wed, 8 Mar 2017 14:56:03 +0000</resolved>
                                    <version>1.5.0</version>
                                    <fixVersion>1.7.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="1531767" author="levuphuong" created="Thu, 23 Mar 2017 22:29:20 +0000"  >&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;I pull new source code and change my project win32 to x64 platform which is same with mongoc platform build tool on windows.&lt;br/&gt;
Now it is successfully built without error.&lt;/p&gt;

&lt;p&gt;Thanks so much. &lt;/p&gt;</comment>
                            <comment id="1529804" author="xgen-internal-githook" created="Tue, 21 Mar 2017 20:43:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2054&quot; title=&quot;Windows static build is broken in 1.5.0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2054&quot;&gt;&lt;del&gt;CDRIVER-2054&lt;/del&gt;&lt;/a&gt; use MONGOC_EXPORT for gridfs funs&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/14cc86790f158288da4dad636d904064a91dee06&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/14cc86790f158288da4dad636d904064a91dee06&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1529779" author="xgen-internal-githook" created="Tue, 21 Mar 2017 20:21:27 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2054&quot; title=&quot;Windows static build is broken in 1.5.0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2054&quot;&gt;&lt;del&gt;CDRIVER-2054&lt;/del&gt;&lt;/a&gt; use MONGOC_EXPORT for exports&lt;/p&gt;

&lt;p&gt;We&apos;d used BSON_EXPORT, but that doesn&apos;t work now because it was updated&lt;br/&gt;
in libbson commit 5b5b74e0. Now, if BSON_COMPILATION isn&apos;t defined,&lt;br/&gt;
BSON_EXPORT does &lt;b&gt;not&lt;/b&gt; export symbols. We should properly make a new&lt;br/&gt;
macro MONGOC_EXPORT that exports symbols iff MONGOC_COMPILATION is set.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/6341c7fecbb828fa0f8df6020dc7beeb355400bd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/6341c7fecbb828fa0f8df6020dc7beeb355400bd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1528497" author="levuphuong" created="Mon, 20 Mar 2017 18:47:05 +0000"  >&lt;p&gt;I make sure mongoc_static-1.0.lib added already. I added libs with config VC ++&lt;del&gt;&amp;gt; Library Directories, Linker&lt;/del&gt;&amp;gt;Input and also checked with 2 lines code. no error with these lines.&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;#pragma comment( lib, &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;bson-static-1.0.lib&quot;&lt;/span&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; )&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;#pragma comment( lib, &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;mongoc-static-1.0.lib&quot;&lt;/span&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; )&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;I also try to create sample .lib and then add to my project. it worked fine.&lt;/p&gt;

&lt;p&gt;i have problem &quot;_&lt;em&gt;imp&lt;/em&gt;_mongoc&quot; when&lt;br/&gt;
#include &quot;mongoc.h&quot;&lt;br/&gt;
then i changed&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;#define BSON_STATIC&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;#include &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;mongoc.h&quot;&lt;/span&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;&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;The problem is &quot;_&lt;em&gt;imp&lt;/em&gt;_mongoc&quot;.&lt;/p&gt;

&lt;p&gt;I think &quot;_&lt;em&gt;imp_bson&lt;/em&gt;&quot;, &quot;_&lt;em&gt;imp&lt;/em&gt;_mongoc&quot; and &quot;_mongoc&quot; also relate to prefix in &quot;bson-macros.h&quot; file.&lt;br/&gt;
And I also suspect problem my project use C++ and the lib in C which i showed problem in below link.&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/5b5b74e0f045d7c639bc071d124515e2c982c29e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/5b5b74e0f045d7c639bc071d124515e2c982c29e&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

</comment>
                            <comment id="1527664" author="rustyx" created="Sun, 19 Mar 2017 16:09:50 +0000"  >&lt;p&gt;This will not fix &quot;unresolved external symbol &amp;#95;mongoc_init&quot;. You probably forgot to link with mongoc_static-1.0.lib.&lt;/p&gt;

&lt;p&gt;This particular issue is limited to &amp;#95;&amp;#95;imp_bson&amp;#95; related errors. Once libbson is bumped and BSON_STATIC is added to static builds, &amp;#95;&amp;#95;imp_bson&amp;#95; related errors should go away.&lt;/p&gt;</comment>
                            <comment id="1520468" author="levuphuong" created="Thu, 9 Mar 2017 21:37:37 +0000"  >&lt;p&gt;I am sorry but i still get error. &lt;br/&gt;
My simple test cpp in MS C++ studio still has error:&lt;br/&gt;
error LNK2019: unresolved external symbol _mongoc_init referenced in function _wmain&lt;br/&gt;
I commented in the commit. Can you take a look and help me find out solution?&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/5b5b74e0f045d7c639bc071d124515e2c982c29e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/5b5b74e0f045d7c639bc071d124515e2c982c29e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1517379" author="xgen-internal-githook" created="Mon, 6 Mar 2017 23:34:41 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2054&quot; title=&quot;Windows static build is broken in 1.5.0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2054&quot;&gt;&lt;del&gt;CDRIVER-2054&lt;/del&gt;&lt;/a&gt; fix libbson static lib in MSVC&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/5b5b74e0f045d7c639bc071d124515e2c982c29e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/5b5b74e0f045d7c639bc071d124515e2c982c29e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1514066" author="jesse" created="Thu, 2 Mar 2017 02:50:49 +0000"  >&lt;p&gt;I&apos;m going to submit a libbson fix to for code review. Then:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;libmongoc fix&lt;/li&gt;
	&lt;li&gt;Instructions in both libs&apos; docs&lt;/li&gt;
	&lt;li&gt;C++ Driver update to take advantage of the fixes&lt;/li&gt;
	&lt;li&gt;Update C++ Driver docs if needed&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="1513992" author="levuphuong" created="Thu, 2 Mar 2017 02:33:33 +0000"  >&lt;p&gt;Hi @Rustam Abdullaev &lt;br/&gt;
I have &quot;__mpl&quot; problem when i call API. and my project is using visual studio 2012. So i cannot build mongocxx.&lt;br/&gt;
And I also tried to define BSON_API or BSON_COMPILATION, but it causes many other errors.&lt;/p&gt;

&lt;p&gt;Can you share me the way hack to use static library C on Windows?&lt;/p&gt;</comment>
                            <comment id="1499378" author="bjori" created="Wed, 15 Feb 2017 15:43:45 +0000"  >&lt;p&gt;Thank you for the detailed analysis.&lt;/p&gt;

&lt;p&gt;You are correct that we do not have any tests for static builds in evergreen at the moment.&lt;/p&gt;</comment>
                            <comment id="1499210" author="rassi@10gen.com" created="Wed, 15 Feb 2017 05:46:34 +0000"  >&lt;p&gt;I can reproduce &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rustyx&quot; class=&quot;user-hover&quot; rel=&quot;rustyx&quot;&gt;rustyx&lt;/a&gt;&apos;s issue with their attached project.  Building on Rustam&apos;s investigation, the cause of this issue appears to be a libmongoc regression introduced in 1.5.0 by &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1347&quot; title=&quot;Define per symbol visibility rather then using separate export symbol files&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1347&quot;&gt;&lt;del&gt;CDRIVER-1347&lt;/del&gt;&lt;/a&gt;, which breaks the static build of the C driver on Windows.  When I attempt to reproduce this issue with Rustam&apos;s attached project against mongocxx r3.0.3, the build succeeds when I have libmongoc da7e2e2 installed (just prior to first commit of &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1347&quot; title=&quot;Define per symbol visibility rather then using separate export symbol files&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1347&quot;&gt;&lt;del&gt;CDRIVER-1347&lt;/del&gt;&lt;/a&gt;), and fails when I have libmongoc 44765ab installed (last commit of &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1347&quot; title=&quot;Define per symbol visibility rather then using separate export symbol files&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1347&quot;&gt;&lt;del&gt;CDRIVER-1347&lt;/del&gt;&lt;/a&gt;).  As such, I&apos;m moving this issue to CDRIVER.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1347&quot; title=&quot;Define per symbol visibility rather then using separate export symbol files&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1347&quot;&gt;&lt;del&gt;CDRIVER-1347&lt;/del&gt;&lt;/a&gt; applies the BSON_API macro to the entire API surface of the driver.  Based on my reading of &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1347&quot; title=&quot;Define per symbol visibility rather then using separate export symbol files&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1347&quot;&gt;&lt;del&gt;CDRIVER-1347&lt;/del&gt;&lt;/a&gt;, the original intent of doing this was to add &amp;#95;&amp;#95;attribute&amp;#95;&amp;#95;((visibility(&quot;default&quot;))) to all API function declarations when &amp;#95;&amp;#95;GNUC&amp;#95;&amp;#95; is defined; however, this also &lt;b&gt;unconditionally&lt;/b&gt; adds &amp;#95;&amp;#95;declspec(dll*) to all API function declarations when _MSC_VER is defined, and it&apos;s not clear to me whether that was considered at the time.  The issue is that &amp;#95;&amp;#95;declspec(dll*) should only be applied when building/using the shared library on Windows, not when building/using the static library on Windows.  The analogous logic for the legacy C++ driver is here: &lt;a href=&quot;https://github.com/mongodb/mongo-cxx-driver/blob/legacy-1.1.2/src/mongo/client/export_macros.h#L43-L55&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-cxx-driver/blob/legacy-1.1.2/src/mongo/client/export_macros.h#L43-L55&lt;/a&gt;.  The symptom of this issue is that the DLL-ified symbol names that the application is looking for (e.g. &quot;&amp;#95;&amp;#95;imp&amp;#95;&amp;#95;bson_iter_init&quot;) don&apos;t match the symbol names exported by the libmongoc/libbson static libraries (e.g. &quot;bson_iter_init&quot;).&lt;/p&gt;

&lt;p&gt;The C++ driver team never noticed this issue, as we currently have no build integration for static libmongoc at all, Windows or otherwise (I&apos;ll be filing a ticket for this shortly, and linking it here).  However, four of our users noticed this in the past week or two (users Simon and Romain at &lt;a href=&quot;https://groups.google.com/forum/#!topic/mongodb-user/iUaqAMScXMM&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!topic/mongodb-user/iUaqAMScXMM&lt;/a&gt;, user Pia_who_love_Sia at &lt;a href=&quot;http://stackoverflow.com/questions/42003413/mongocxx-in-windows-lnk2001-unresolved-external-symbol-imp-mongoc-read-prefs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/42003413/mongocxx-in-windows-lnk2001-unresolved-external-symbol-imp-mongoc-read-prefs&lt;/a&gt;, and Rustam, on this ticket) when they upgraded to mongocxx 3.1.x, which requires libmongoc 1.5.0+.  These users are manually listing mongoc-static-1.0.lib / bson-static-1.0.lib as project library dependencies in Visual Studio.&lt;/p&gt;

&lt;p&gt;Does the C driver Evergreen integration attempt to compile the examples against a static build of the driver?  If not, then we should certainly file a ticket for that as well, as I believe that would have also caught this issue.&lt;/p&gt;

&lt;p&gt;Rustam reports above that the hack of defining BSON_COMPILATION while building mongocxx appears to work around this issue (by forcing BSON_API to expand to __declspec(dllexport), so the symbol names match), but I&apos;m not sure if there are any other adverse affects of doing this.  Linking against the dynamic build of the C driver also avoids this issue, but I would guess that that isn&apos;t feasible for all users.&lt;/p&gt;

&lt;p&gt;Thank you so much for your original report, your reproducible case, and your patience, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rustyx&quot; class=&quot;user-hover&quot; rel=&quot;rustyx&quot;&gt;rustyx&lt;/a&gt;!&lt;/p&gt;</comment>
                            <comment id="1495497" author="rustyx" created="Wed, 8 Feb 2017 22:09:18 +0000"  >&lt;p&gt;Please try using it.&lt;/p&gt;

&lt;p&gt;bson-static-1.0.lib is fine, but &lt;b&gt;it can&apos;t be used&lt;/b&gt;. As the header declares everything &lt;tt&gt;&amp;#95;&amp;#95;declspec(dllimport)&lt;/tt&gt; none of entries in bson-static-1.0.lib can be found as everything gets the &lt;tt&gt;&amp;#95;&amp;#95;imp&amp;#95;&amp;#95;&lt;/tt&gt; prefix.&lt;/p&gt;
</comment>
                            <comment id="1495166" author="jesse" created="Wed, 8 Feb 2017 18:49:09 +0000"  >&lt;p&gt;I don&apos;t &lt;b&gt;think&lt;/b&gt; this is a libbson build bug. Our CMakeLists.txt defines BSON_COMPILATION:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/libbson/blob/1.6.0/CMakeLists.txt#L202&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/blob/1.6.0/CMakeLists.txt#L202&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ve rebuilt the driver just now with VS 2015 according to the standard build instructions:&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;cmake -G &apos;Visual Studio 14 2015 Win64&apos;&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;MSBuild.exe /m ALL_BUILD.vcxproj&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;dumpbin /SYMBOLS bson-static-1.0.lib&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;This shows that &quot;bson_iter_init&quot; is defined. There&apos;s no &quot;&amp;#95;&amp;#95;imp&amp;#95;&amp;#95;bson_iter_init&quot;.&lt;/p&gt;</comment>
                            <comment id="1494101" author="david.golden" created="Tue, 7 Feb 2017 17:59:37 +0000"  >&lt;p&gt;Thank you. We&apos;ll take a look.&lt;/p&gt;</comment>
                            <comment id="1493842" author="rustyx" created="Tue, 7 Feb 2017 14:29:38 +0000"  >&lt;p&gt;Added test project&lt;/p&gt;</comment>
                            <comment id="1493540" author="david.golden" created="Tue, 7 Feb 2017 02:37:40 +0000"  >&lt;p&gt;Rustam, I&apos;d like to try to replicate this locally and diagnose it. Could you please send/attach/post the build-equivalent of an &lt;a href=&quot;http://sscce.org&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;SSCCE&lt;/a&gt;?  I.e. The exact step by step commands you&apos;re executing to get the failure you described and the exact step by step commands you&apos;re executing to get the success?&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;</comment>
                            <comment id="1493172" author="rustyx" created="Mon, 6 Feb 2017 19:35:19 +0000"  >&lt;p&gt;Don&apos;t think it&apos;s a versioning issue because adding &lt;tt&gt;&quot;/D BSON_COMPILATION&quot;&lt;/tt&gt; to CMAKE_CXX_FLAGS for libbsoncxx fixes the issue.&lt;/p&gt;

&lt;p&gt;I tried libmongoc 1.6.0 and master with libmongocxx (release/stable).&lt;/p&gt;</comment>
                            <comment id="1492881" author="david.golden" created="Mon, 6 Feb 2017 16:17:07 +0000"  >&lt;p&gt;Hi, Rustam.  Which specific version of libmongoc do you have installed?  3.1.0 requires libmongoc 1.5 or later, so you might be missing those symbols because you have an old version. See the &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/releases&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongoc releases page&lt;/a&gt; to get updated source.&lt;/p&gt;</comment>
                            <comment id="1492824" author="rustyx" created="Mon, 6 Feb 2017 15:35:03 +0000"  >&lt;p&gt;Seems to be caused by this code in libbson / &lt;tt&gt;bson-macros.h&lt;/tt&gt;:&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;#ifdef _MSC_VER&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;#ifdef BSON_COMPILATION&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;#define BSON_API __declspec(dllexport)&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;#else&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;#define BSON_API __declspec(dllimport)&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;#endif&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;I think that BSON_COMPILATION was defined before, and that&apos;s why it kind of worked (at least I don&apos;t know what happens with functions declared dllexport in a static lib).&lt;/p&gt;

&lt;p&gt;But obviously that is not the solution. There should be a way to specify BSON_STATIC and #define BSON_API as empty.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="351971">CDRIVER-2037</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="297495">CDRIVER-1347</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="148907" name="mongotest.zip" size="4659" author="rustyx" created="Tue, 7 Feb 2017 14:29:17 +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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CDRIVER-2074</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hraxev:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1602">C Driver 2017 2 - Feb 10, 2019</customfieldvalue>
    <customfieldvalue id="1641">C Driver 2017 3 - March 7</customfieldvalue>
    <customfieldvalue id="1666">C Driver 2017 3 - March 8</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>