[Scons-users] Does not copy/link my file target/lib when needed?

edA-qa mort-ora-y eda-qa at disemia.com
Sat Jan 27 03:36:00 EST 2018


I'm trying to get a library file linked in a variant_dir before the
configuration is complete (this is in order to get the rpath references
correct). It links the file once, but it does not copy it again if the
destination is deleted.

My SConstruct

	baseEnv = Environment(
	    BUILD_DIR='build'
	    )
	Export('baseEnv')
	baseEnv.SConscript('src/SConscript', variant_dir=baseEnv['BUILD_DIR'], duplicate=0)
	Default(baseEnv['BUILD_DIR'])


My src/SConscript

    import os

    Import('baseEnv')

    def SymLink():
        def Impl(target, source, env):
            print( "SymLink" )
            os.symlink(os.path.abspath(str(source[0])),
os.path.abspath(str(target[0])))
            return 0

        return Action(Impl, "linking file to $TARGET from $SOURCE" )


    env = baseEnv.Clone()
    env.Append( LIBPATH = './' )

    lib_some = 'some'
    lib_some_ref = 'libsome.so'

    env.Command( lib_some_ref, '../lib/' + lib_some_ref, SymLink() )

    conf = Configure(env)
    conf.CheckLib( lib_some )
    env = conf.Finish()

You can place any shared library into lib/libsome.so to test. I'm
testing on Linux at the moment.

I've tried env.Requires( '.', ... ) with the Command as well, but no luck.

It also doesn't appear to be an issue with the Symlink action since a
Copy action has the same problem:

env.Command( lib_some_ref, '../lib/' + lib_some_ref,
Copy("$TARGET","$SOURCE")

-- 
edA-qa mort-ora-y 
http://mortoray.com/

Leaf - the language we always wanted
http://leaflang.org/



More information about the Scons-users mailing list