Re: Ninja compilation fails after using include path file instead of "-I" option

Bill Deegan <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAEyG4CHk0LZNOUCbzyi4KxPTqEm-cs9OvB8pE2_pdxiD_YSZSQ@mail.gmail.com>
Daniel,

Is it likely we should define TEMPFILE for mingw as we do for win32?

-Bill

On Sat, Apr 9, 2022 at 12:39 AM Daniel Moody <[email protected]> wrote:

> hello liruncong,
>
> You can not directly use the @ response file syntax with ninja, you should
> instead use SCons internal feature for this, TEMPFILE, as the ninja tool
> will know how to process that.
>
> TEMPFILE is meant to be substituted in the full command line, here is an
> example how to make your CC compile commands use the tempfile:
>
> env['_RT_CCCOM'] = env['CCCOM']
> env['CCCOM'] = "${TEMPFILE('$_RT_CCCOM', '$CCCOMSTR')}"
>
> Here is a diff of your project where I am using the response file in scons
> and it works with ninja:
>
> diff --git a/bsp/beaglebone/SConstruct b/bsp/beaglebone/SConstruct
> index e9eceb553..01c27a83f 100644
> --- a/bsp/beaglebone/SConstruct
> +++ b/bsp/beaglebone/SConstruct
> @@ -56,8 +56,26 @@ def GenIncPathsFile(env, objs):
>      env.Depends(objs, [incPathsFile])
>      return incPathsFile
>
> -incPathsFile = GenIncPathsFile(env, objs)
> -env["_CPPINCFLAGS"] = "@%s" % (incPathsFile)
> +env['_RT_CCCOM'] = env['CCCOM']
> +env['CCCOM'] = "${TEMPFILE('$_RT_CCCOM', '$CCCOMSTR')}"
> +
> +# This is only to see the output command using the response file if
> building with scons
> +env['CCCOMSTR'] = None
> +
> +# My system did not hit the limit in order to use response file,
> +# so I had to force it to make sure
> +# I could see the response files in use by scons
> +env['MAXLINELENGTH'] = 10
> +
> +# This function make the response file use the correct slash for mingw
> +from SCons.Subst import quote_spaces
> +def tempfile_arg_esc_func(arg):
> +    arg = quote_spaces(arg)
> +    return arg.replace('\\', '/')
> +env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func
> +
> +#incPathsFile = GenIncPathsFile(env, objs)
> +#env["_CPPINCFLAGS"] = "@%s" % (incPathsFile)
>
>  # make a building
>  DoBuilding(TARGET, objs)
>
>
>
> On Fri, Apr 8, 2022 at 7:23 PM liruncong2018 via Scons-users <
> [email protected]> wrote:
>
>> git repository: https://github.com/liruncong/NinJaTest.git bsp:
>> beaglebone
>> mingw:
>> https://download-sh-cmcc.rt-thread.org:9151/www/aozima/env_released_1%20.2.0.7z gcc
>> position : env\tools\gnu_gcc\arm_gcc\mingw\bin
>> python: 3.8.5(anaconda)
>> platform: win11
>> scons: https://github.com/SCons/scons.git
>>
>> Directly using the "scons" command can compile successfully, but using
>> "scons --experimental=ninja" will fail to compile. Ninja compilation
>> fails after using include path file instead of "-I" option · Issue #4130 ·
>> SCons/scons (github.com) <https://github.com/SCons/scons/issues/4130>
>>
>> Due to the length limit of the windows command line, in our actual
>> project, the command will exceed the length limit of the windows command
>> line, so this test case uses the "@file <https://github.com/file>"
>> option.
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> [email protected]
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
> _______________________________________________
> Scons-users mailing list
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.