[Scons-users] TempFileMunge conflicts with ccache

Daniel Moody dmoody256 at gmail.com
Mon May 11 14:56:58 EDT 2020


left out a small piece to that sample SConstruct in my previous message, I
was missing the setting of the MAXLINELENGTH variable to force
tempfiles for small command lines. Sample SConstruct should look like this:

env = Environment()
env.Program('test', ['test.cpp'])

env["CXX"] = "ccache " + env["CXX"]
env['MAXLINELENGTH'] = 6

# make linux do tempfile
env["LINKCOM"] = "${{TEMPFILE('{0}', '')}}".format(env['LINKCOM'])
env["SHLINKCOM"] = "${{TEMPFILE('{0}', '')}}".format(env['SHLINKCOM'])
if not 'libtool' in env['TOOLS']:
    env["ARCOM"] = "${{TEMPFILE('{0}', '')}}".format(env['ARCOM'])

On Mon, May 11, 2020 at 1:52 PM Daniel Moody <dmoody256 at gmail.com> wrote:

> Assuming your referring to the last few lines
> https://github.com/mongodb/mongo/blob/master/site_scons/site_tools/ccache.py#L123-L126
>
> In this case you are changing the compiler command (COM) variables instead
> of the "compiler" variables, which I was showing as a working case in my
> previous message.
>
> The $( ... $) wrapping part Mongo is I think (from the comments) just to
> prevent unwanted rebuilds, (correct me if I'm misunderstanding). My
> previous message was about ccache simply not working and failing with an
> error message similar to this:
>
> Using tempfile /tmp/tmp3s045_3z.lnk for command line:
> ccache g++ -o test test.o
> ccache @/tmp/tmp3s045_3z.lnk
> ccache: error: execv of @/tmp/tmp3s045_3z.lnk failed: No such file or
> directory
> scons: *** [count] Error 1
>
> generated from a basic SConstruct like this:
>
> env = Environment()
> env.Program('test', ['test.cpp'])
>
> env["CXX"] = "ccache " + env["CXX"]
>
>
> # make linux do tempfile
> env["LINKCOM"] = "${{TEMPFILE('{0}', '')}}".format(env['LINKCOM'])
> env["SHLINKCOM"] = "${{TEMPFILE('{0}', '')}}".format(env['SHLINKCOM'])
> if not 'libtool' in env['TOOLS']:
>     env["ARCOM"] = "${{TEMPFILE('{0}', '')}}".format(env['ARCOM'])
>
> Where it feeds the temp file directly to ccache.
>
> This is more related to the Mongo Jira ticket Andrew mentioned previously
> in this thread: https://jira.mongodb.org/browse/SERVER-38389
>
>
> On Mon, May 11, 2020 at 12:37 PM Mathew Robinson <mathew at chasinglogic.io>
> wrote:
>
>> Hey Daniel,
>>
>> MongoDB actually fixed this but using $() which tells subst to not use
>> the CCACHE as part of the temp file content.
>>
>> You can see it here:
>>
>>
>> https://github.com/mongodb/mongo/blob/master/site_scons/site_tools/ccache.py
>> _____________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200511/d2e7f581/attachment.html>


More information about the Scons-users mailing list