[Scons-users] 回复: "Defer to SCons to build build\__cpp_path.txt"
Bill Deegan
bill at baddogconsulting.com
Thu Apr 28 14:23:33 EDT 2022
Try sorting the return value from glob.glob(), glob()'s item ordering are
not always stable
On Thu, Apr 28, 2022 at 1:16 PM liruncong2018 via Scons-users <
scons-users at scons.org> wrote:
> Hello Daniel Moody,
> Attached is the build.ninja file generated by executing the scons command
> twice, there are indeed differences.
> Below I extract the first difference:
> <<< first
> build $
>
> D$:\work\current\master\knd\libs\CncSys\K2000PRJ\DataItems\DataItemApiwInputDialogUi.autogen.h
> $
>
> D$:\work\current\master\knd\libs\CncSys\K2000PRJ\DataItems\DataItemApiwInputDialogUi.autogen.cpp:
> $
> GENERATED_CMD | $
>
> D$:\work\current\master\knd\libs\CncSys\K2000PRJ\DataItems\DataItemApiwInputDialog_Ui.py
> >>>
> <<< second
> build $
>
> D$:\work\current\master\knd\libs\CncSys\K2000PRJ\DataItems\DataItemApiwInputDialogUi.autogen.cpp
> $
>
> D$:\work\current\master\knd\libs\CncSys\K2000PRJ\DataItems\DataItemApiwInputDialogUi.autogen.h:
> $
> GENERATED_CMD | $
>
> D$:\work\current\master\knd\libs\CncSys\K2000PRJ\DataItems\DataItemApiwInputDialog_Ui.py
> >>>
>
> You can see that "autogen.cpp" and "autogen.h" are in different order.
>
> The relevant generation scripts for these two files(cppFile, hFile) are as
> follows:
> <<<
> UiPyFiles = glob.glob(cwd + "/**/*_Ui.py", recursive=True)
> for f in UiPyFiles:
> (filePath, fileName) = os.path.split(f)
> pyModuleName = fileName[:-6]
> cppFile = f[:-6] + "Ui.autogen.cpp"
> hFile = cppFile[:-4] + ".h"
> Env.Command(
> [cppFile, hFile],
> [f],
> [
> '''@cd ${SOURCE.dir} && @%s -c "import
> sys;sys.path.insert(0, '%s');sys.path.insert(0, '%s');from %s import %s;
> %s.render();"''' % (sys.executable, os.path.join(rtconfig.KND_ROOT,
> "tools", "python").replace("\\", "/"), filePath.replace("\\", "/"),
> fileName[:-3], pyModuleName, pyModuleName),
> "@echo Create file: %s, %s" % (cppFile, hFile)
> ]
> )
> path = os.path.relpath(cppFile, cwd)
> obj = Env.Object(target = path[:-4] + ".o", source = cppFile)
> autogenObjs += obj
> >>>
>
> You can see that the target order in env.Command is consistent with the
> order in the second build.ninja.
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Daniel Moody" <dmoody256 at gmail.com>;
> *发送时间:* 2022年4月27日(星期三) 晚上11:36
> *收件人:* "liruncong2018"<liruncong2018 at qq.com>;"SCons users mailing list"<
> scons-users at scons.org>;
> *主题:* Re: [Scons-users] "Defer to SCons to build build\__cpp_path.txt"
>
> Hello Liruncong,
>
> I could not reproduce your case in a simple test. I think your build is
> creating some differences each time scons is run. The ninja tool will
> regenerate the ninja file if there are any differences from the previous
> ninja file, for example even if the command line options for some
> compilation are the same but in a different order. In that case all things
> which ninja will defer to scons to build, must be rebuilt. SCons however
> may determine for those items that they do not need to be rebuilt
> because the inputs (the CPPPATH string) have not changed.
>
> I pushed an update to the ninja_integration_branch which prints an
> additional message if scons decided to regenerate the file. If it decides
> to regenerate the build.ninja file you should see a message like:
>
> Generated new build.ninja!
>
> If scons decided not to regenerate the ninja file because there were no
> changes you should see:
>
> No updates detected, build.ninja not regenerated.
>
> If you see the ninja file is being regenerated each time, please make a
> copy of the build.ninja file, then run again and compare the original copy
> to the newly generated ninja file. You can send me both copies so I can see
> if for some reason scons is causing the unexpected regeneration.
>
> On Wed, Apr 27, 2022 at 7:16 AM liruncong2018 <liruncong2018 at qq.com>
> wrote:
>
>> Hi,
>> After successful compilation, select a file and add a blank line, then
>> execute the following two commands in sequence:
>> 1) run_ninja_env.bat -d explain build\__cpp_path.txt
>> 2) scons -j%NUMBER_OF_PROCESSORS% --experimental=ninja
>> The attachment is the execution result of the above two commands.
>> The following output from the log record should be removed:
>> ···
>> [2/2518] Defer to SCons to build build\__link_objects.txt [2K
>> [3/2518] Defer to SCons to build build\__exe_cpp_path.txt [2K
>> [4/2518] Defer to SCons to build build\__cpp_path.txt [2K
>> [5/2518] Defer to SCons to build build\__define_options.txt [2K
>> ···
>> From the file time point of view, the 4 txt files have not been
>> recompiled, so there should be no output information.
>>
>> ------------------ 原始邮件 ------------------
>> *发件人:* "Daniel Moody" <dmoody256 at gmail.com>;
>> *发送时间:* 2022年4月27日(星期三) 凌晨2:51
>> *收件人:* "SCons users mailing list"<scons-users at scons.org>;
>> *抄送:* "liruncong2018"<liruncong2018 at qq.com>;
>> *主题:* Re: [Scons-users] "Defer to SCons to build build\__cpp_path.txt"
>>
>> It depends on the specific files in question and their dependencies.
>> Looking at the most recent build.ninja you sent, these files only depend on
>> the scons build (they are from the Textfile builder, so then in the scons
>> build, the only dependency is the source string, which is generated from
>> CPPPATH in the SConscripts files).
>>
>> I would like to know why ninja decided to rebuild these files if they are
>> already built. After this issue is occurring, then run this command
>>
>> run_ninja_env.bat -d explain build\__cpp_path.txt
>>
>> And ninja should say why it is attempting to rebuild the file. Please
>> send me the output as well.
>>
>> On Tue, Apr 26, 2022, 8:18 AM liruncong2018 via Scons-users <
>> scons-users at scons.org> wrote:
>>
>>> Hi,
>>>>
>>>> When there are file errors that are not corrected, the following lines
>>>>> always appear when compiling, but the file time has not changed, indicating
>>>>> that the file has not been regenerated.
>>>>
>>>> Is it possible not to display this information if the file is not
>>>>> regenerated? Otherwise, users will think these files have been updated.
>>>>
>>>> ···
>>>>
>>>> [2/2518] Defer to SCons to build build\__cpp_path.txt [2K
>>>>>
>>>>> [3/2518] Defer to SCons to build build\__link_objects.txt [2K
>>>>>
>>>>> [4/2518] Defer to SCons to build build\__define_options.txt [2K
>>>>>
>>>>> ···
>>>>>
>>>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>> _______________________________________________
> 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/20220428/869e41c7/attachment-0001.htm>
More information about the Scons-users
mailing list