[Scons-users] SCons Errors and build approach

Ronex Dicapriyo ronex_89 at yahoo.in
Fri Jun 27 16:04:40 EDT 2014


Hello,

Please help me with the following queries:

1) 

    Is it possible to call SConscript from another SConscript ?
    I noticed that it raises an error message as below when I tried to do this:
        scons: *** Invalid SConscript usage - no parameters


    Suppose I have following directory structure:
        root_dir
            |_ SConstruct

            |_ module_1
              |_ SConscript

            |_ module_2
              |_ SConscript

    Here module_1's library is dependent on module_2's library. So when SConstruct calls the SConscript of module_1 from module_1, I first want to calls the SConscript of module_2 with library target.

    What is scons way to handle such interdependency ?

 
    My SConstrcut accepts the command line argumetn of the module to e build say if scons -Q --module=module_1 then it calls SConscript of module_1. For this depency I have used python's subprocess in module_1 to execute scons -Q --module=module_2 and then build module_1's library. Rather then subprocess it could me much better if I can use SConscript function so that I can also export environment specif to one module to other dependent module.


    But I am not sure whether is the right way to handle such depencies ? I have tried to depict the scenario in brief,m there are 30 to 40 modules having some inetrdependencies on one or more then one modules.

2)
    On windows when I tried to build shared library from static libraries it generated following error message:
    libxyz.a is static and is not compatible with shared target libpqr.dll
    I have used -fPIC option in CPPFLAGS variable, But it still raises the same error.

    I tried following two approaches:
    2.a)
        env.Append(CPPFLAGS=['-fPIC'])
    env.SharedLibrary(target = 'pqr', source=src_files, LIBS=['libxyz.a', 'libabc.a'] LIBPATH=[<path_of_xyz>, <path_of_abc>])
This results in error message mentioned above.

    2.b)

       env.Append(CPPFLAGS=['-fPIC']) src_file = Glob('*.cpp')
        obj_files = [os.path.splitext(file) for file in src_list]
        env.SharedObject(target=obj_files, source=src_files, CPPPATH='include')
        env.SharedLibrary(target='pqr', source=obj_files)
 
But this generates an error message: AttributeError: 'File' object has no attribute 'rfind'
So on windows what all flags and options are required to build shared library properly. How above erros can be fixed ?

3)
    How to export multiple environmet variables or other spcefic variables from SConscript ?
Alternatiely What are all possible different syntax to export variables ?

i.e, 
env = Environment()
envDbg = env.Clone(CPPFLAGS = ['-g', '-O0'])
lib_list = [lib1.a, lib2.a, lib3.a]
SConscript(name ..., export = {env='env', 'envDbg', lib_list})  ---> what is proper way to export ?


Regards,
Ronex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140628/c40a2ad1/attachment.html>


More information about the Scons-users mailing list