<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:41:50 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>[SERVER-16663] options requested in top-level SConstruct to support non-default libraries and includes</title>
                <link>https://jira.mongodb.org/browse/SERVER-16663</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I have a small diff but I am waiting for legal to let me know whether I can share that so I will describe the change. I am building MongoDB with a compiler and library toolchain that works &quot;in production&quot; so I don&apos;t want to use the default locations for libraries and include files. I ended up needing two options in the top-level SConstruct to make this work:&lt;/p&gt;

&lt;p&gt;1) &lt;tt&gt;&amp;#45;&amp;#45;dont-add-local-paths&lt;/tt&gt; - this changes MongoDB to not add local paths. For example, I want to keep this from being added for 64-bit linux:&lt;br/&gt;
    &lt;tt&gt;env.Append( EXTRALIBPATH=[&quot;/usr/lib64&quot; , &quot;/lib64&quot; ] )&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;2) &lt;tt&gt;&amp;#45;&amp;#45;linkflags&lt;/tt&gt; - values here get appended to LINKFLAGS. I used this to add extra flags and libraries to link with jemalloc. I ended up using &quot;:&quot; as the option separator because options already use &quot;,&quot; and the following is an example of a value I used: &lt;br/&gt;
&lt;tt&gt;&amp;#45;&amp;#45;linkflags=&quot;-Wl,&amp;#45;&amp;#45;whole-archive /path/to/libjemalloc.a:-Wl,&amp;#45;&amp;#45;no-whole-archive&quot;&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;I can also use this to set rpath options, although I don&apos;t need to do that yet we do that for other binaries like mysqld...&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&amp;#45;&amp;#45;linkflags=&quot;--enable-new-dtags:-Wl,-rpath=/path/to/production/lib&quot;&lt;/tt&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="176067">SERVER-16663</key>
            <summary>options requested in top-level SConstruct to support non-default libraries and includes</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="jonathan.reams@mongodb.com">Jonathan Reams</assignee>
                                    <reporter username="mdcallag">Mark Callaghan</reporter>
                        <labels>
                    </labels>
                <created>Wed, 24 Dec 2014 15:32:09 +0000</created>
                <updated>Fri, 27 Mar 2015 20:32:57 +0000</updated>
                            <resolved>Wed, 21 Jan 2015 20:59:43 +0000</resolved>
                                                    <fixVersion>3.0.0-rc6</fixVersion>
                                    <component>Build</component>
                                        <votes>0</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="861008" author="mdcallag" created="Mon, 23 Mar 2015 16:20:35 +0000"  >&lt;p&gt;For RPATH &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-17694&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-17694&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I still haven&apos;t figured out the right way to quote it. If my shell script echoes the command line, I can copy/paste it to run scons. But if my shell script invokes scons directly, then it isn&apos;t working yet. My shell quoting knowledge is weak so I will ask a local expert.&lt;/p&gt;</comment>
                            <comment id="860997" author="acm" created="Mon, 23 Mar 2015 16:12:05 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mcallaghan%40fb.com&quot; class=&quot;user-hover&quot; rel=&quot;mcallaghan@fb.com&quot;&gt;mcallaghan@fb.com&lt;/a&gt; -&lt;/p&gt;

&lt;p&gt;Re the quoting, the single quotes worked fine for me for passing multiple arguments in via LINKFLAGS, both from the command line and from a shell script, at least on OS X.&lt;/p&gt;

&lt;p&gt;For the SCons RPATH variable: I agree we should have this. I just found a need for it myself and had been planning to add it. Would you mind filing a new ticket though? I think it is likely we would want to backport to 3.0 and the legacy C++ driver, and it would be easier to track that workflow under a new ticket.&lt;/p&gt;


</comment>
                            <comment id="860536" author="mdcallag" created="Mon, 23 Mar 2015 05:08:41 +0000"  >&lt;p&gt;It works, but I still would like for SConstruct to support RPATH. &lt;/p&gt;

&lt;p&gt;I need to read up on  shell quoting. I have a shell script that calls scons and using this in the shell script does work...&lt;br/&gt;
scons LINKFLAGS=&quot;--enable-new-dtags -Wl,-whole-archive /foobar/libjemalloc.a ...&quot;&lt;br/&gt;
scons LINKFLAGS=&apos;--enable-new-dtags -Wl,-whole-archive /foobar/libjemalloc.a ...&apos;&lt;/p&gt;

&lt;p&gt;But this works in the shell script&lt;br/&gt;
scons LINKFLAGS=&quot;\&quot;--enable-new-dtags -Wl,-whole-archive /foobar/libjemalloc.a ...\&quot;&quot;&lt;/p&gt;</comment>
                            <comment id="860522" author="mdcallag" created="Mon, 23 Mar 2015 04:03:17 +0000"  >&lt;p&gt;Can you add RPATH too?&lt;/p&gt;

&lt;p&gt;CPPPATH worked for me but I get errors from LINKFLAGS for:&lt;br/&gt;
scons LINKFLAGS=&quot;-&lt;del&gt;enable-new-dtags -Wl,&lt;/del&gt;-whole-archive /foobar/libjemalloc.a&quot; ...&lt;/p&gt;

&lt;p&gt;Warning:  the -W option is not yet implemented&lt;br/&gt;
ESC[?1034hscons: Reading SConscript files ...&lt;br/&gt;
Mkdir(&quot;build/scons&quot;)&lt;br/&gt;
scons version: 2.3.0&lt;br/&gt;
python version: 2 6 6 &apos;final&apos; 0&lt;/p&gt;

&lt;p&gt;scons: *** Error converting option: LINKFLAGS&lt;br/&gt;
No closing quotation&lt;/p&gt;

&lt;p&gt;&amp;#8212;&lt;/p&gt;

&lt;p&gt;In MySQL 5.6 with cmake we do stuff like:&lt;br/&gt;
MYSQLD_LDFLAGS+=&quot; &lt;del&gt;Wl,&lt;/del&gt;-no-whole-archive $LIB/libunwind.a&quot;&lt;br/&gt;
LDFLAGS+=&quot; --enable-new-dtags -Wl,-rpath=/foobar/$BUILD_ENV/lib&quot;&lt;/p&gt;

&lt;p&gt;${CMAKE} ${CMAKE_FLAGS} -DWITH_MYSQLD_LDFLAGS=&quot;$MYSQLD_LDFLAGS&quot; &lt;/p&gt;</comment>
                            <comment id="809922" author="jonathan.reams@10gen.com" created="Wed, 21 Jan 2015 20:59:43 +0000"  >&lt;p&gt;We added scons variables to set the initial values of ARFLAGS, CCFLAGS, CFLAGS, CPPDEFINES CPPPATH, CXXFLAGS, LIBPATH, LIBS, LINKFLAGS, SHCCFLAGS, SHCFLAGS, SHCXXFLAGS, and SHLINKFLAGS  on the command line. Different flags are separated by a space, as though you were setting the corresponding shell environment variable.&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;scons CCFLAGS=&quot;-fno-omit-frame-pointer mongod -O4&quot; all&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="809909" author="xgen-internal-githook" created="Wed, 21 Jan 2015 20:51:54 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jbreams&apos;, u&apos;name&apos;: u&apos;Jonathan Reams&apos;, u&apos;email&apos;: u&apos;jbreams@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-16663&quot; title=&quot;options requested in top-level SConstruct to support non-default libraries and includes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-16663&quot;&gt;&lt;del&gt;SERVER-16663&lt;/del&gt;&lt;/a&gt; Add variables to set CFLAGS et all on command-line&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1b72a40d26b43b64a6d08717e2a01a31e6e861a8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1b72a40d26b43b64a6d08717e2a01a31e6e861a8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="795823" author="acm" created="Wed, 31 Dec 2014 18:00:25 +0000"  >&lt;p&gt;Hi Mark -&lt;/p&gt;

&lt;p&gt;If we move to allowing command line overrides of things like CFLAGS, SHLINKFLAGS, etc., then I think it would be natural to extend that syntax to allow setting CPPPATH and LIBPATH as well, and probably deprecate or remove the cpppath, libpath, and extrapath options, which have less than ideal semantics at present.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Andrew&lt;/p&gt;


</comment>
                            <comment id="795600" author="mdcallag" created="Wed, 31 Dec 2014 04:29:36 +0000"  >&lt;p&gt;I had another problem and my workaround is to change --extrapath so that it only sets paths for libraries and then added --extraincpath to do the same for include paths.&lt;/p&gt;

&lt;p&gt;I use gcc 4.8.1 and with non-standard library paths have been using --extrapath to find them, but that also added include paths and there was a compile error courtesy of some (questionable) code in src/mongo/crypto/tom/tomcrypt_custom.h that declares functions that libc provides leading to a compile error when the declarations did not match.&lt;/p&gt;

&lt;p&gt;&amp;lt;noformat&amp;gt;&lt;br/&gt;
/* macros for various libc functions you can change for embedded targets */&lt;br/&gt;
#ifndef XMALLOC&lt;br/&gt;
    #ifdef malloc&lt;br/&gt;
    #define LTC_NO_PROTOTYPES&lt;br/&gt;
    #endif&lt;br/&gt;
#define XMALLOC  malloc&lt;br/&gt;
#endif&lt;br/&gt;
&amp;lt;noformat&amp;gt;&lt;/p&gt;

&lt;p&gt;Which resulted in ...&lt;br/&gt;
&amp;lt;noformat&amp;gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;1 &quot;src/mongo/crypto/tom/tomcrypt_cfg.h&quot; 1&lt;/li&gt;
	&lt;li&gt;41 &quot;src/mongo/crypto/tom/tomcrypt_cfg.h&quot;&lt;br/&gt;
 void * malloc(size_t n);&lt;br/&gt;
 void * realloc(void *p, size_t n);&lt;br/&gt;
 void * calloc(size_t n, size_t s);&lt;br/&gt;
 void free(void *p);&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt; void qsor(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));&lt;/p&gt;



&lt;p&gt; clock_t clock(void);&lt;/p&gt;


&lt;p&gt; void * memcpy(void *dest, const void *src, size_t n);&lt;br/&gt;
 int memcmp(const void *s1, const void *s2, size_t n);&lt;br/&gt;
 void * memse(void *s, int c, size_t n);&lt;/p&gt;

&lt;p&gt; int strcmp(const char *s1, const char *s2);&lt;br/&gt;
&amp;lt;noformat&amp;gt;&lt;/p&gt;</comment>
                            <comment id="793721" author="acm" created="Wed, 24 Dec 2014 17:10:32 +0000"  >&lt;p&gt;Hi Mark -&lt;/p&gt;

&lt;p&gt;Thanks for the bug report. A few comments.&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;RE local paths: There is suspicion, but not yet proof, that those path entries are vestigial at best. They can be actively harmful in some cases, as you point out. If you are using a properly configured toolchain, the correct default library search paths should be baked into the toolchain, and the SConstruct should not be in the business of guessing about the relationship between current platform and library or header search paths. Adding the flag you propose would be useful as we could then easily test whether builds with --dont-add-local-paths worked correctly on our build systems of record. If so, the flag could just be removed along with the now-known-to-be-useless path adornments.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;RE extra link flags: This has been a frequent internal request. Ideally this would be done not only for link flags but also for all of CFLAGS, CCFLAGS, CXXFLAGS,  LINKFLAGS, and the &quot;SH&quot; prefixed version of those. One subtlety to consider is whether the user flags should come before flags added in the SConstruct itself, in which case there is a risk that the user specified flags are overridden, or after, which might subvert the aim of setting them (e.g. can&apos;t pass configure checks without the flags, but we don&apos;t add them until later). As a result I suspect that we actually need a user to be able to set both CXXFLAGS (set at Environment construction time) and EXTRA_CXXFLAGS (set after Configure), for instance. So, this becomes a lot of flags to add. As you note, there are also some complications regarding delimiters, quoting, spaces in paths, etc., for which there is not yet a clearly optimal solution. Finally, SCons offers a &apos;Variables&apos; facility, which would make it possible to specify user flag customizations in a potentially more natural format: &quot;scons CCFLAGS=-fno-omit-frame-pointer&quot; for instance. But this mechanism has its own issues with how to specify multiple flags, spaces in names, etc.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Overall, there is agreement that improvements along these lines would be beneficial.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="177855">SERVER-16791</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="148057">CXX-286</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="74101">SERVER-9554</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 24 Dec 2014 17:10:32 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 47 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 47 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jonathan.reams@mongodb.com</customfieldvalue>
            <customfieldvalue>mdcallag</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlfzb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs516n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>154358</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="346">BUILD 1</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjqdr:</customfieldvalue>

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