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

Bill Deegan bill at baddogconsulting.com
Sat Jan 27 16:59:05 EST 2018


On Sat, Jan 27, 2018 at 1:43 PM, edA-qa mort-ora-y <eda-qa at disemia.com>
wrote:

> The library is built as part of an external build process (LLVM build
> scripts). I specify the directory to it as part of my scons variables.
>
> The reason to link it (or copy would be fine), is because I need the
> linker to create a relative RPATH to the library (there are no flags to
> configure this on Linux/OSX linkers other than just putting the library
> beside the other libraries/EXEs).
>
> I could possibly remove it from the Check step and do my own checking.
> Originally I wasn't concerned about RPATH, thus it was setup differently.
> I'm not sure why putting in it the check though prevents the other step
> from updating it.
>

It's not preventing it from checking it, it's that the check will happen
first and thus not find it where the symlink will put it.

Not sure why you even need to check it.
User specifies location on command line:
scons MY_LIB=/home/balh/lib/libabc.so  (or MY_LIB_PATH=/home/blah/lib )
You have your programs link against
variant_dir/libs
You have your symlink or whatever copy/link the file form MY_LIBPATH to
variant_dir/libs

Then it just works..
If the file is not there, the build will fail.

What are you trying to achieve by the check other than that the file is
present and linkable?



>
>
>
> On 27/01/18 22:00, Bill Deegan wrote:
>
> Configure contexts are usually evaluated first.
>
> Why are you doing this?
>
> If you're building the library, it's not clear why you need to have
> Configure check if the library exists...
> Is there some strange possibility that the library you build cannot be
> linked against?
>
> -Bill
>
> On Sat, Jan 27, 2018 at 12:36 AM, edA-qa mort-ora-y <eda-qa at disemia.com>
> wrote:
>
>> 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/
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
>
>
> _______________________________________________
> Scons-users mailing listScons-users at scons.orghttps://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
> --
> edA-qa mort-ora-y http://mortoray.com/
>
> Leaf - the language we always wantedhttp://leaflang.org/
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180127/7a21eea6/attachment.html>


More information about the Scons-users mailing list