|
From: Jonathan W. <jw...@ju...> - 2020-03-11 23:27:53
|
Hi Vladimir On Wed, Mar 11, 2020 at 10:34:46PM +0300, Vladimir Sadovnikov wrote: > I've finally solved the issue. Thanks so much for pursuing this. > Here's the final solution: > > I've found that regression occurred when changing from 3.0.4 version to > > 3.0.5. I've inspected the changes > > in the SConf.py::_shutdown method and ONLY THEN found that the option > > --config=force was the case. > > Removing it from build call solved the problem. > > The overall discussion you may observe in this topic: > https://github.com/SCons/scons/issues/3579 I'm pleased that the problem has at least been understood. If I understand the situation correctly, it appears that between scons 3.0.4 and 3.0.5 a change was made to the way the Configure Finish() method operates which causes a problem for FFADO if "--config=force" is specified as part of the scons command. Since you've looked at the scons source code, do you have any thoughts as to how the issue can be resolved? Do you know what environment is actually returned by Finish() when "--config=force" is not given? Reading between the lines of the response in the github issue, it appears that assigning "env" to the value returned by conf.Finish() is wrong - even though it happens to do the right thing unless "--config=force" is specified. "env" is created at line SConstruct:95 using the running environment as a template. This undergoes some changes depending on configuration requirements before being linked to a newly created Configure object at line 215. The code which follows clearly makes a number of additions to "env" directly. The Configure instance is used to run a number of tests, and I assume that at least some of these cause the Configure object's enviornment to be modified. Finally at line 474 we have env = conf.Finish() For earlier versions of scons (and versions from 3.0.5 if "--config=force" was not set), evidence suggests that the enviroment returned by conf.Finish() includes the changes made to "env" outside of the Configure object. Otherwise this code would never have worked historically or in current cases with scons 3.1 when "--config=force" was not given. You mentioned that commenting this line out made things work under scons 3.1 with ""--config=force". This indicates that we don't need the environment modified by the Configure object. Furthermore, this is backed up after looking carefully at the SConstruct code. Among the changes made to "env" are the setting of various FLAGS variables based on the result of the tests run through the Configure object. An exhaustive inspection would need to be carried out to confirm that we don't need anything from the modified Configure environment, but at this stage it seems unlikely. With this said, I see two possible options: 1. Simply discard the environment returned by conf.Finish(). 2. Arrange to merge the environment returned by conf.Finish() with that of "env" (although it remains to be seen how to behave when both environments have common variables with different values - one would need to take precedence). This seems to be what happens currently when "--config=force" is given. I have no idea how to do option 2. There doesn't appear to be an envronment-merge method in the Environment object. Perhaps Export/Import could be utilised for this, but I'm not sure at this stage. My feeling at present is to go with option 1. However, we would probably need to run a number of tests to ensure that it does do what is needed across a number of systems and configurations. I would welcome further comments and suggestions on this topic. Regards jonathan |