<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:58:45 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>[CXX-286] Support additional custom compiler and linker options when invoking scons (e.g. rpath)</title>
                <link>https://jira.mongodb.org/browse/CXX-286</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;I have been unable to find a way to build the C++ driver with additional custom linker options.  I am currently attempting to build libmongoclient with  &lt;tt&gt;&lt;del&gt;Wl,-z,origin,-rpath=\$ORIGIN,-rpath-link=$(pwd)&lt;/tt&gt; for a non-system-wide installation.  I can almost accomplish this with the option &lt;tt&gt;&lt;/del&gt;-ld=&quot;clang++ -Wl,-z,origin,-rpath=\$\$ORIGIN,-rpath-link=$(pwd)&lt;/tt&gt;, but the string is evaluated for variables multiple times at different depths resulting in error messages such as the following:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;scons: *** &lt;span class=&quot;error&quot;&gt;&amp;#91;build/linux2/c++11/cc_clang/cxx_clang++/ld_clang++ -Wl_-z_origin_-rpath=$ORIGIN_-rpath-link=_tmp_dependencies_lib/use-system-boost/libmongoclient.so&amp;#93;&lt;/span&gt; Implicit dependency `build/linux2/c+&lt;ins&gt;11/cc_clang/cxx_clang&lt;/ins&gt;&lt;ins&gt;/ld_clang&lt;/ins&gt;+ -Wl_-z_origin_-rpath=&lt;em&gt;-rpath-link=_tmp_dependencies_lib/use-system-boost/third_party/libshim_boost.a&apos; not found, needed by target `build/linux2/c+&lt;ins&gt;11/cc_clang/cxx_clang&lt;/ins&gt;&lt;ins&gt;/ld_clang&lt;/ins&gt;+ -Wl&lt;/em&gt;-z_origin_-rpath=$ORIGIN_-rpath-link=_tmp_dependencies_lib/use-system-boost/libmongoclient.so&apos;.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Note the mismatch where sometimes &lt;tt&gt;$ORIGIN&lt;/tt&gt; follows &lt;tt&gt;-rpath&lt;/tt&gt; and other times it doesn&apos;t.  Although this may be a bug, passing linker options as part of the linker command seems like a hack that may not be worth supporting.&lt;/p&gt;

&lt;p&gt;Although my current use-case could be addressed by adding some rpath options to SConstruct, I suspect the issue may be better addressed with an approach that would allow any custom linker options rather than rewriting every linker option users may need as a scons option.&lt;/p&gt;

&lt;p&gt;As a better solution, would it be possible to support &lt;tt&gt;$LDFLAGS&lt;/tt&gt; from the environment (as autotools- and cmake-based build systems do) for passing custom linker options?  Possibly protected by an option similar to &lt;tt&gt;-&lt;del&gt;cc-use-shell-environment&lt;/tt&gt; such as &lt;tt&gt;&lt;/del&gt;-ldflags-use-shell-environment&lt;/tt&gt;?&lt;/p&gt;

&lt;p&gt;I think this may be useful for &lt;tt&gt;$CFLAGS&lt;/tt&gt; and &lt;tt&gt;$CXXFLAGS&lt;/tt&gt; as well, but I can file that as another issue if it is worth considering separately.&lt;/p&gt;

&lt;p&gt;Thanks for considering,&lt;br/&gt;
Kevin&lt;/p&gt;</description>
                <environment></environment>
        <key id="148057">CXX-286</key>
            <summary>Support additional custom compiler and linker options when invoking scons (e.g. rpath)</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="andrew.morrow@mongodb.com">Andrew Morrow</assignee>
                                    <reporter username="kevinoid">Kevin Locke</reporter>
                        <labels>
                            <label>legacy-cxx</label>
                    </labels>
                <created>Mon, 21 Jul 2014 06:50:42 +0000</created>
                <updated>Fri, 27 May 2022 01:34:46 +0000</updated>
                            <resolved>Fri, 23 Jan 2015 23:19:43 +0000</resolved>
                                    <version>legacy-0.0-26compat-2.6.3</version>
                                    <fixVersion>legacy-1.0.0-rc4</fixVersion>
                                    <component>Build</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="665216" author="kevinoid" created="Mon, 21 Jul 2014 14:08:17 +0000"  >&lt;p&gt;Hi Andrew,&lt;/p&gt;

&lt;p&gt;Thanks for responding so quickly and thoroughly.  That makes a lot of sense and I agree on all points.  Feel free to merge this ticket with &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-104&quot; title=&quot;Option to add flags to client build&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-104&quot;&gt;&lt;del&gt;CXX-104&lt;/del&gt;&lt;/a&gt;, they do appear to be duplicates (sorry about that).&lt;/p&gt;

&lt;p&gt;As for how to delimit the strings, it seems like there is not much consistency in this area between build systems.  In building the other libraries for my current project, I have escaped &lt;tt&gt;$ORIGIN&lt;/tt&gt; many different ways in &lt;tt&gt;LDFLAGS&lt;/tt&gt; for the different projects and it is never documented and usually a matter of trial-and-error between escaping for Makefile macros (with &lt;tt&gt;$$&lt;/tt&gt;) and shell escapes (either quotes or backslashes).  My recommendation would be to handle word-splitting like the shell (if that&apos;s easily possible inside scons) so directories with spaces would need to be quoted or the space escaped, and avoid variable expansion in the passed string, but if that is difficult I wouldn&apos;t spend much engineering effort reimplementing shell parsing since anyone going down this road will be used to dealing with trial-and-error escaping.  But that&apos;s just my 2c at the moment and not a well-researched opinion.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Kevin&lt;/p&gt;</comment>
                            <comment id="665200" author="acm" created="Mon, 21 Jul 2014 13:53:12 +0000"  >&lt;p&gt;Hi Kevin -&lt;/p&gt;

&lt;p&gt;There is actually a (not very detailed) ticket requesting this feature (see &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-104&quot; title=&quot;Option to add flags to client build&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-104&quot;&gt;&lt;del&gt;CXX-104&lt;/del&gt;&lt;/a&gt;). I think it is a reasonable request, and I had been hoping to do it for the upcoming 1.0.0-rc1 release of the legacy driver. I think we would want, at minimum, a way to specify early flags (e.g. ones that are applied at Environment construction time) in case they are necessary to make things like the compiler validity checks pass, and late flags (so that you can override flags that we put on the build line ourself).&lt;/p&gt;

&lt;p&gt;We should probably offer this for:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;CFLAGS&lt;/li&gt;
	&lt;li&gt;CCFLAGS&lt;/li&gt;
	&lt;li&gt;CXXFLAGS&lt;/li&gt;
	&lt;li&gt;LINKFLAGS&lt;/li&gt;
	&lt;li&gt;SHLINKFLAGS&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We would need to decide whether to use the SCons Variables feature for this, or make these options (--cflags and --extra-cflags, etc.?). An additional question, as you point out, is quoting. If using the Variables feature, how should this work if you want to pass several flags? Should they be comma delimited? A quoted space delimited string seems easiest, but then there are problems with things like spaces in paths. Similar subtleties exist with making them --options. And there are probably still some issues to be considered re escaping things like $ORIGIN as you mention.&lt;/p&gt;

&lt;p&gt;Finally, please note that this work would be done on the legacy branch, but it is unlikely that it would be backported to the 26compat branch, since that is now a maintenance release series.&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="176067">SERVER-16663</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="49422">CXX-104</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hs0n67:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>128199</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_22279" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Server Compat</customfieldname>
                        <customfieldvalues>
                                        <label>3.0</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>