<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:17:26 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-3225] Static libraries produced by cmake builds on Linux cannot be used without modification</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3225</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;It&apos;s possible that I simply don&apos;t understand the required intricacies of building with CMake. If so I apologise.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What am I doing&lt;/b&gt;&lt;br/&gt;
At my company we use libmongoc/libbson on different flavors of Ubuntu and Windows 10. We link statically against both libs because we want to keep the number of redistributables down to a minimum. MongoC and BSON are in most cases linked against a shared library which we distribute in-house. This was a breeze with 1.9.2 using automake, but seems to be slightly broken in 1.14.0 (possibly other versions as well).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Problem 1 (I consider this as being slightly broken)&lt;/b&gt;&lt;br/&gt;
Using the following CMake command, followed by &lt;tt&gt;make &amp;amp;&amp;amp; make install&lt;/tt&gt; results in static libraries that cannot be linked together &lt;em&gt;since libmongoc-static-1.0.a will contain symbols that are also present in libbson-static-1.0.a&lt;/em&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;   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;CFLAGS=-fPIC CXXFLAGS=-fPIC cmake -DENABLE_ZLIB=BUNDLED -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_EXAMPLES=OFF -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ../&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 offending symbols are&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;bson_b64_initialize_rmap&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;bson_b64_ntop&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;bson_b64_pton&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;_bson_md5_append&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;_bson_md5_finish&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;_bson_md5_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;   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;bson_md5_process&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;And the symptom of which is multiple definition errors when linking libmongoc and libbson against my artifact(s).&lt;br/&gt;
The workaround I ended up with here is to use objcopy to weaken the symbols in libmongoc-static-1.0.a post-build, before creating an archive and uploading it to our internal artifact storage for general consumption.&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;   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;objcopy --weaken-symbol bson_b64_initialize_rmap --weaken-symbol bson_b64_ntop --weaken-symbol bson_b64_pton --weaken-symbol _bson_md5_append --weaken-symbol _bson_md5_finish --weaken-symbol _bson_md5_init --weaken-symbol bson_md5_process some_path_to/lib/libmongoc-static-1.0.a&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;&lt;b&gt;Problem 2 (minor, but annoying)&lt;/b&gt;&lt;br/&gt;
Using the following CMake command, followed by &lt;tt&gt;make &amp;amp;&amp;amp; make install&lt;/tt&gt; results in static libraries that do not support relocation (i.e no -fPIC) and thus cannot be linked against a shared object.&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;   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;cmake -DENABLE_ZLIB=BUNDLED -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_EXAMPLES=OFF -DENABLE_TESTS=OFF  -DCMAKE_BUILD_TYPE=Release ../&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 workaround I used here was to simply set &lt;tt&gt;CFLAGS=-fPIC CXXFLAGS=-fPIC&lt;/tt&gt;, but it would be nice if there was a proper build flag for setting them. Like &lt;tt&gt;ENABLE_PIC&lt;/tt&gt; or something along those lines.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Problem 3 (confusing)&lt;/b&gt;&lt;br/&gt;
The libraries produced by building the CMake projects are not properly versioned. It&apos;s been 1.0 since forever.&lt;/p&gt;

&lt;p&gt;The workaround for problem 1 seems overly hackish just to be able to use the static libraries. I&apos;m not sure how you&apos;d fix it in a proper manner since I&apos;m not very familiar with mongoc&apos;s CMake setup. Is there to your knowledge a better way to achieve this than my current workaround? Would it be possible to get it fixed at your end so that I don&apos;t have to feel so dirty using objcopy?&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</description>
                <environment>Ubuntu 16.04/18.04, quite possibly Linux in general</environment>
        <key id="839716">CDRIVER-3225</key>
            <summary>Static libraries produced by cmake builds on Linux cannot be used without modification</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="13201">Fixed</resolution>
                                        <assignee username="roberto.sanchez@mongodb.com">Roberto Sanchez</assignee>
                                    <reporter username="emanuel.birge">Emanuel Birge</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Jul 2019 12:44:56 +0000</created>
                <updated>Sat, 28 Oct 2023 11:29:13 +0000</updated>
                            <resolved>Tue, 25 Feb 2020 20:49:58 +0000</resolved>
                                    <version>1.14.0</version>
                                    <fixVersion>1.17.0-beta</fixVersion>
                    <fixVersion>1.17.0</fixVersion>
                                    <component>Build</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2915307" author="xgen-internal-githook" created="Thu, 27 Feb 2020 22:16:04 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;rcsanchez97&apos;, &apos;name&apos;: &apos;Roberto C. S&#225;nchez&apos;, &apos;email&apos;: &apos;roberto@connexer.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3225&quot; title=&quot;Static libraries produced by cmake builds on Linux cannot be used without modification&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3225&quot;&gt;&lt;del&gt;CDRIVER-3225&lt;/del&gt;&lt;/a&gt; use COMMON_PREFIX pre-processor macro throughout&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/b7aa48780bf130fb62d662db681d5226eed9de93&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/b7aa48780bf130fb62d662db681d5226eed9de93&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2908417" author="roberto.sanchez" created="Tue, 25 Feb 2020 20:49:58 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=emanuel.birge&quot; class=&quot;user-hover&quot; rel=&quot;emanuel.birge&quot;&gt;emanuel.birge&lt;/a&gt;, the two commits I just pushed address your first two concerns.  &lt;/p&gt;

&lt;p&gt;The symbol collisions have been fixed by prefixing them using the pre-processor, depending on which library they are being compiled for.  PIC can be enabled for the static library components using a new option, as requested.&lt;/p&gt;

&lt;p&gt;We have discussed your third concern internally and we are considering how to proceed.  Keep in mind that the &quot;1.0&quot; in the name of libmongoc and libbson (and their associated CMake and pkg-config packages) is not the ABI version.  The ABI of libmongoc and libbson has not been bumped from &quot;0&quot; in the history of either library, as neither has experienced an ABI-breaking change.  It is not immediately clear that there would be much benefit from incrementing the minor or patch versions of the ABI.  If there are specific use cases of which we should be aware that would benefit from more precise ABI versioning, please let us know.&lt;/p&gt;</comment>
                            <comment id="2908389" author="xgen-internal-githook" created="Tue, 25 Feb 2020 20:37:27 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;rcsanchez97&apos;, &apos;name&apos;: &apos;Roberto C. S&#225;nchez&apos;, &apos;email&apos;: &apos;roberto@connexer.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3225&quot; title=&quot;Static libraries produced by cmake builds on Linux cannot be used without modification&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3225&quot;&gt;&lt;del&gt;CDRIVER-3225&lt;/del&gt;&lt;/a&gt; add CMake option for building static components with -fPIC&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/f023d3b9fe269bbf29ae813f014487df57230aca&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/f023d3b9fe269bbf29ae813f014487df57230aca&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2908388" author="xgen-internal-githook" created="Tue, 25 Feb 2020 20:37:25 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;rcsanchez97&apos;, &apos;name&apos;: &apos;Roberto C. S&#225;nchez&apos;, &apos;email&apos;: &apos;roberto@connexer.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3225&quot; title=&quot;Static libraries produced by cmake builds on Linux cannot be used without modification&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3225&quot;&gt;&lt;del&gt;CDRIVER-3225&lt;/del&gt;&lt;/a&gt; prevent collisions of common symbols&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/9097d9f1cb4c0f4ad45f27a419f6f633137ae7dd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/9097d9f1cb4c0f4ad45f27a419f6f633137ae7dd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2339730" author="kevin.albertson" created="Tue, 23 Jul 2019 19:45:29 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=emanuel.birge&quot; class=&quot;user-hover&quot; rel=&quot;emanuel.birge&quot;&gt;emanuel.birge&lt;/a&gt;, thank you for the detailed report! We will investigate this after our 1.15.0 release.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </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|hv0isf:</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>