[Scons-users] Weird problem in MS Windows

Albert Arquer albert.arquer at gmail.com
Mon Oct 30 09:40:16 EDT 2017


Hello,

I have been battling with an SCons issue (at least that is what I believe
it is). This problem is intermittent, however it only seems to appear when
I build targets with the "-j" option, launching multiple threads.

You can see the error trace here:

scons: *** [<target_path>] AttributeError : 'module' object has no
attribute 'exists'
Traceback (most recent call last):
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Taskmaster.py",
line 234, in execute
    if not t.retrieve_from_cache():
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\FS.py", line
2935, in retrieve_from_cache
    return self.get_build_env().get_CacheDir().retrieve(self)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Environment.py",
line 1010, in get_CacheDir
    path = SCons.Defaults.DefaultEnvironment()._CacheDir_path
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Defaults.py", line
88, in DefaultEnvironment
    _default_env = SCons.Environment.Environment(*args, **kw)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Environment.py",
line 982, in __init__
    apply_tools(self, tools, toolpath)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Environment.py",
line 107, in apply_tools
    env.Tool(tool)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Environment.py",
line 1789, in Tool
    tool(self)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Tool\__init__.py",
line 197, in __call__
    self.generate(env, *args, **kw)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Tool\default.py",
line 40, in generate
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Tool\__init__.py",
line 1108, in tool_list
    linker = FindTool(linkers, env) or linkers[0]
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Tool\__init__.py",
line 993, in FindTool
    t = Tool(tool)
  File "C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Tool\__init__.py",
line 113, in __init__
    self.exists = module.exists
AttributeError: 'module' object has no attribute 'exists'
scons: building terminated because of errors.


Basically scons seems to fail while loading built-in tools, specifically
during loading of the "mslink" python module, which I assume is something
specific to microsoft windows.
I have tried to narrow it down and have found very little coherency, for
example, if I print the object's attributes, methods, etc. right before
scons fails by putting the following code on the Tool.__init__ method in
SCons/Tool/__init__.py:

            print("Class of module is: {}".format(module.__class__))
            print("Name is: {}".format(module.__name__))
            print("File is: {}".format(module.__file__))
            print("Doc is: {}".format(module.__doc__))
            print dir(module)

I get the following:

Class of module is: <type 'module'>
Name is: SCons.Tool.mslink
File is: C:\Python27\Lib\site-packages\scons-2.5.1\SCons\Tool\mslink.pyc
Doc is: SCons.Tool.mslink

Tool-specific initialization for the Microsoft linker.

There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.


['RegServerFunc', 'SCons', '__builtins__', '__doc__', '__file__',
'__name__', '__package__', '__revision__', '_dllEmitter', '_dllSources',
'_dllTargets', '_windowsLdmodSources', '_windowsLdmodTargets',
'embedManifestDllAction', 'embedManifestDllCheck',
'embedManifestDllCheckAction', 'embedManifestExeAction',
'embedManifestExeCheck', 'embedManifestExeCheckAction', 'ldmodEmitter',
'msvc_exists', 'msvc_setup_env_once', 'os', 'pdbGenerator', 'prog_emitter',
'regServerAction', 'regServerCheck', 'shlibLinkAction',
'windowsLibEmitter', 'windowsShlinkSources', 'windowsShlinkTargets']




As you can see the __doc__ text matches the one found in the "mslink" file,
however for some reason the "generate" method is not available and python
crashes when it is called...

Does anybody have an idea of what could this be due to? I remember when I
installed SCons and launched targets with the -j switch SCons advised me to
install some package for windows, which I did, I don't remember the
package's name right now.

In absence of a better solution I wonder if it would be possible to stop
scons from loading any of those tools, as I don't think I am using any of
them... This would only be an option if it could be done without modifiying
the SCons source code.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20171030/abec9368/attachment.html>


More information about the Scons-users mailing list