[Scons-users] How to structure Hier Builds (was thread jacked OSX Library Link)?

Bill Deegan bill at baddogconsulting.com
Mon Aug 7 13:02:17 EDT 2017


Ryan,

There're a couple sources for such.

See chapters 14 & 15 in the users guide
http://scons.org/doc/production/HTML/scons-user.html#chap-hierarchical

Pretty sure there are some examples in the wiki as well.

-Bill
p.s. Please create a new subject for your reply if you are creating a new
topic..


On Mon, Aug 7, 2017 at 9:36 AM, Ryan <ryan.chaves at gmail.com> wrote:

> I'm lurking on this list after having had a question answered some months
> ago. It seems like I've read a number of threads on this mailing list that
> touch on the topics of "how SCons works within your project's directory
> structure" and especially "uses of VariantDir() (or
> SConstruct(variant_dir=X) and things to watch out for". In those threads,
> I've seen the answer or response typically contain some phrasing of the
> sort "The typical directory structure for a SCons project looks like X".
> But, I do not recall seeing in any of the SCons documentation (user guide,
> man page, Google searches) a discussion on this topic. I hope I've just
> missed it, as it seems to be a fundamental part of understanding the
> idiomatic way to use SCons.
>
> Can you point me (us?) to a place where this specific topic is
> documented/discussed? If it doesn't exist, how best can the community
> contribute to getting it properly documented?
>
>
>
> On Mon, Aug 7, 2017 at 12:17 PM Bill Deegan <bill at baddogconsulting.com>
> wrote:
>
>> Generally the SConscript would be located in the directory with the
>> source and the variant dir wouldn't be the top level direcotry.
>>
>> In essence in your example the current dir is variant dir'd to build.
>> This can lead to some nastiness where on subsequent builds the variant
>> dir build can get replicated in the build dir.
>>
>> I'll try to take a look at this later today.
>> For sure the _RPATH which is what creates the rpath constructs on the
>> command line is not propagating properly (at least on OSX)
>>
>> -Bill
>>
>> On Mon, Aug 7, 2017 at 9:01 AM, edA-qa mort-ora-y <eda-qa at disemia.com>
>> wrote:
>>
>>> Also note that the OSX command line is not including the `-rpath`
>>> setting. It should.
>>>
>>>
>>> On 07/08/17 17:57, edA-qa mort-ora-y wrote:
>>>
>>> The attached ZIP file contains a minimal project that shows the problem.
>>> Just type `scons` to build. The output is `build/dohello` with library
>>> `hello`
>>>
>>> On Linux this works as intended.
>>>
>>> On OSX this fails. Be sure to try and run `build/dohello` from somewhere
>>> other than the directory where `build` resides (since it will work
>>> there).   Run `otool -L build/dohello` to see that it's referencing
>>> `build/libhello.dylib` instead of the desired `libhello.dylib`
>>>
>>>
>>> On 07/08/17 14:36, Bill Deegan wrote:
>>>
>>> Can you make a simple test case which demonstrates the issue?
>>>
>>>
>>> On Sun, Aug 6, 2017 at 11:49 PM, edA-qa mort-ora-y <eda-qa at disemia.com>
>>> wrote:
>>>
>>>> g++ -o build/libleaf_util.dylib -dynamiclib build/util/dump_base.os
>>>> build/util/file.os build/util/number.os build/util/object_holder.os
>>>> build/util/unicode.os -Lbuild/build/lib -Lsrc/build/lib
>>>> -L/usr/local/Cellar/boost/1.63.0/lib -Lbuild -Lsrc
>>>> -L/Users/edA-qa/src-leaf/llvm/install/lib
>>>> -L/usr/local/Cellar/gmp/6.1.2/lib -lboost_unit_test_framework
>>>> -lboost_program_options -lboost_regex -lLLVM -lgmp -lgmpxx
>>>> -lboost_filesystem -lboost_system
>>>>
>>>> g++ -o build/leaf build/bin/leaf.o build/bin/test_expecter.o
>>>> -Lbuild/build/lib -Lsrc/build/lib -L/usr/local/Cellar/boost/1.63.0/lib
>>>> -Lbuild -Lsrc -L/Users/edA-qa/src-leaf/llvm/install/lib
>>>> -L/usr/local/Cellar/gmp/6.1.2/lib -lboost_unit_test_framework
>>>> -lboost_program_options -lboost_regex -lLLVM -lgmp -lgmpxx
>>>> -lboost_filesystem -lboost_system -lleaf_lang -lleaf_parser -lleaf_util
>>>> -lleaf_ir -lleaf_ir_llvm -lleaf_runner
>>>>
>>>>
>>>>
>>>>
>>>> On 07/08/17 00:05, Bill Deegan wrote:
>>>>
>>>> Can you post a gist of the build log?
>>>> Specifically the link line for the shared library and for the program?
>>>>
>>>> On Sun, Aug 6, 2017 at 12:55 PM, edA-qa mort-ora-y <eda-qa at disemia.com>
>>>> wrote:
>>>>
>>>>> After having getting my shared libraries working on Linux I'm trying
>>>>> now
>>>>> on OSX. The approach provided before does not do the correct thing on
>>>>> OSX. For example, instead of linking to `libleaf_util.dylib`, it links
>>>>> to `build/libleaf_util.dylib`.
>>>>>
>>>>> Library created as:
>>>>>
>>>>>     lib_util_name = 'leaf_util'
>>>>>     lib_util = env.SharedLibrary( lib_util_name, [
>>>>>         'util/dump_base.cpp',
>>>>>         'util/file.cpp',
>>>>>         'util/number.cpp',
>>>>>         'util/object_holder.cpp',
>>>>>         'util/unicode.cpp',
>>>>>         ] )
>>>>>
>>>>> Then used as:
>>>>>
>>>>> leaf = env.Program( 'leaf', [
>>>>>     'bin/leaf.cpp',
>>>>>     'bin/test_expecter.cpp',
>>>>>     ],
>>>>>     LIBS = env['LIBS'] + [ lib_lang_name, lib_parser_name,
>>>>> lib_util_name, lib_ir_name, lib_ir_llvm_name, lib_runner_name ],
>>>>>     )
>>>>>
>>>>>
>>>>> Running `otool -L build/leaf` gives me:
>>>>>
>>>>>     build/libleaf_util.dylib (compatibility version 0.0.0, current
>>>>> version 0.0.0)
>>>>>
>>>>>
>>>>> Using the `otool -l` option also doesn't list any RPATH, though I have
>>>>> this configured:
>>>>>
>>>>>     env['RPATH'] = Literal('\\$$ORIGIN')
>>>>>
>>>>>
>>>>> Full SConscript file:
>>>>> https://gist.github.com/mortoray/0eff2a9a066ad48a6aedab8766503865
>>>>> Full wrapping SConstruct:
>>>>> https://gist.github.com/mortoray/0c7485fa04afb8f4db099132e7b1e723
>>>>>
>>>>> --
>>>>> 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
>>>
>>> _______________________________________________
>>> 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 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
>>>
>>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> 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/20170807/0f4efaa0/attachment-0001.html>


More information about the Scons-users mailing list