[Scons-users] Implicit dependency `None' not found

Stefan Seefeld stefan at seefeld.name
Sat Apr 2 22:42:54 EDT 2016


Hello,

(I'm still chasing after a build error I'm only observing trying to
build a project on Windows, learning more gory details about the Windows
development environment than I'd ever wished having to learn. Please
bear with me !)

Please find attached a SConstruct file I use to configure a project to
build. It starts by checking whether a Python development environment is
present. Again, on Linux everything works as expected, but on WIndows I
get an error. This time it is:


  SCons.Errors.StopError: Implicit dependency `None' not found, needed
by target `.sconf_temp\conftest_0.exe'.

in the generated config.log file. The full content of the config.log
file is attached, too. Any idea what might be going on, or how to debug
this ? (This is, again, using SCons 2.4.1)

Thanks,
        Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...

-------------- next part --------------
#from SCons.Script import AddOption

AddOption('--python', help='the python executable')

def check(context):

    python_source_file = r"""
// If defined, enforces linking againg PythonXXd.lib, which
// is usually not included in Python environments.
#undef _DEBUG
#include "Python.h"
int main()
{
  Py_Initialize();
  Py_Finalize();
  return 0;
}
"""

    import platform
    import subprocess
    import re

    def check_sysconfig(cmd):
        cmd='import distutils.sysconfig as c; print(c.%s)'%cmd
        return subprocess.check_output([python, '-c', cmd]).strip()

    #from SCons.SConf import CheckHeader
    context.Message('Checking for python...')
    python = context.env.GetOption('python') or 'python'
    #context.CheckProg(python)
    incpath = check_sysconfig('get_python_inc()')
    context.env.AppendUnique(CPPPATH=[incpath])
    libpath = check_sysconfig('get_config_var("LIBDIR")')
    libfile = check_sysconfig('get_config_var("LIBRARY")')
    match = re.search('(python.*)\.(a|so|dylib)', libfile)
    lib = None
    if match:
        lib = match.group(1)
        context.env.AppendUnique(LIBS=[lib])
        if match.group(2) == 'a':
            flags = check_sysconfig('get_config_var("LINKFORSHARED")')
            if flags is not None:
                context.env.AppendUnique(LINKFLAGS=flags.split())
    flags = check_sysconfig('get_config_var("MODLIBS")')
    flags += ' ' + check_sysconfig('get_config_var("SHLIBS")')
    flags = [f for f in flags.split() if f != '-L']
    context.env.MergeFlags(' '.join(flags))
    result, output = context.TryRun(python_source_file,'.cpp')
    if not result and context.env['PLATFORM'] == 'darwin':
        # Sometimes we need some extra stuff on Mac OS
        frameworkDir = libpath # search up the libDir tree for the proper home for frameworks
        while frameworkDir and frameworkDir != "/":
            frameworkDir, d2 = os.path.split(frameworkDir)
            if d2 == "Python.framework":
                if not "Python" in os.listdir(os.path.join(frameworkDir, d2)):
                    context.Result(0)
                    print((
                        "Expected to find Python in framework directory %s, but it isn't there"
                        % frameworkDir))
                    return False
                break
        context.env.AppendUnique(LINKFLAGS="-F%s" % frameworkDir)
        result, output = context.TryRun(python_source_file,'.cpp')
    if not result:
        context.Result(0)
        print("Cannot run program built with Python.")
        return False
    if context.env['PLATFORM'] == 'darwin':
        context.env['LDMODULESUFFIX'] = '.so'
    context.Result(1)
    return True

env = Environment()

conf = env.Configure(custom_tests={'python':check})
conf.__dict__['python']()

#env.SharedLibrary('test', ['lib.cc'])
#env.Program('hello.cc', LIBS=['test'], LIBPATH='.')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log
Type: text/x-log
Size: 1443 bytes
Desc: not available
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160402/5c95126b/attachment.bin>


More information about the Scons-users mailing list