[Scons-users] Newbie questions

syost at triad.rr.com syost at triad.rr.com
Wed Apr 26 14:10:37 EDT 2017


Thanks!   The "-I." was indeed being added by the existence of my include (Add my basedir and '-I.' shows up in the gcc -v output, remove my include and it goes away).

But..

Your usage of the phrase "environment" made me realize that maybe I forgot to append the includes in the package level SConscript . But DRAT!   I had already done that.   But I noticed I  done it different.   So I changed it to the way I did it in the project level SConscript and viol'a! it worked.   So to recap

env.Environment(CPPPATH='include1,include2') did NOT work in my package level SConscript

but

MYINCLUDE=['include1',include2']
env=Environment()
env.Append(CPPPATH=MYINCLUDE) DID work


Also.....


This custom builder only processed my first *.sc file

     env.UDBPrecompile(Glob('*.sc')

But this worked worked perfect:

for filename in Glob('*.sc'):
     env.UDBPrecompile(filename)

I don't understand why (remember, I'm just just a python wannabe).   Can anyone explain why?


Thanks!!!!!!

---- William Blevins <wblevins001 at gmail.com> wrote: 
> That may not be a substitution. That is the default CPPPATH, so it may be
> that you aren't passing through the correct env. SCons will not modify abs
> paths to be relative to my knowledge.
> 
> On Apr 26, 2017 10:22 AM, <syost at triad.rr.com> wrote:
> 
> > Sorry for the delay, but I doubled down on reviewing the generated files
> > and found that while they will walk the repository and build
> > anything/everything in sight, (or I can specify a package), it will not
> > walk for the SConscript files.   You have to specify them individually in a
> > python list of what are considered "source" directories.   My lack of
> > python experience kept me from noticing that initially.  Some code to do
> > that should be simple enough.
> >
> > I am now struggling with the  next hurdle we ran across in some packages:
> > gcc not finding some include files properly.  Something in the Append step:
> >
> > INCLUDES = ['project/base', ...some more includes ]
> > env.Append(CPPPATH=INCLUDES)
> >
> > is converting "/project/base" to "." .   In other words the gcc command
> > has "-I." instead of "-I/project/base"
> >
> > That substitution seems to be tripping up any qualified include that is
> > not absolute to the root of the filesystem(like /opt/openssl/include/des.h
> > works), or is not a simple <file.h> or "file.h"(which both work).  In other
> > words, its tripping up any include that is relative to the project base(ie
> > #include <com/XXXX/ss/functionalarea/program1/file.h> which does indeed
> > exist in /project/base/com/XXXX/ss/functionalarea/program1/ but gcc can't
> > find).
> >
> > Any ideas would be welcome but I'm sure its still my inexperience with
> > python and scons so I will continue digging to this.
> >
> > Thanks!
> >
> > ---- Bill Deegan <bill at baddogconsulting.com> wrote:
> > > Can you pastebin the generated SConstruct and a sample(s) of SConscripts?
> > > -Bill
> > >
> > > On Sat, Apr 22, 2017 at 4:28 AM, <syost at triad.rr.com> wrote:
> > >
> > > > Thanks Bill,
> > > >
> > > > Not near the laptop right now but Python 2.7 I believe installs with
> > > > Ubuntu 16.04 which I am running.   I know it is not python 3.x because
> > you
> > > > have to type "python3" to run it.
> > > >
> > > > The underlying packages have nothing in terms of SCons artifacts -
> > just to
> > > > the top repository level.   I then added an SConscript to a single
> > package
> > > > as a guinea pig while I wrote a builder for a database precompilation
> > > > step.   This never was read.   Here is the directory structure:
> > > >
> > > > myrepo   S*.py* files and SConstruct and SConscript (as generated by
> > > > SConsolidator) are here.
> > > > ------com
> > > > ----------company
> > > > -----------------ss
> > > > -------------------functionalarea1
> > > > ----------------------------------program11    (trying to add
> > SConscript
> > > > here for special pre-compile steps)
> > > > ----------------------------------program.1N
> > > > -------------------functionalarea2
> > > > ----------------------------------program21
> > > > ----------------------------------program.2N
> > > > .....and so on.......
> > > >
> > > >
> > > > If my PWD is "myrepo" and I type "scons -k" I actually get lots of
> > > > successful package builds through the tree (or packages fail for
> > > > predictable and understandable reasons). In this scenario program11
> > > > compiles like any other but fails to include my special SConscript
> > > > steps(and print statements prove it is never read).   Also, if I type
> > scons
> > > > -k com/company/ss/functionalarea1/program11 it will build fine too -
> > but
> > > > once again it builds without including my SConscript
> > > >
> > > > If I change my PWD to "program11", add a SConstruct, and then type
> > "scons
> > > > -k" my SConscript is properly read.   But of course, then I would have
> > to
> > > > build separately for several hundred packages since most will have
> > special
> > > > linking, special compiler flags, special DB steps, or post steps(ie
> > perms),
> > > > install directives, etc.  Not ideal and not what I was hoping for.
> > > >
> > > >
> > > > Bottom line is the SConstruct generated by SConsolidator at the top
> > > > "myrepo" directory seems (again - not a python expert) to include the
> > > > necessary logic to walk the subdirs and call SConscript() for each
> > > > SConscript() it finds but they actually seem to be ignored.  So I
> > figured I
> > > > am doing something wrong and hoped you folks could help.
> > > >
> > > > Thanks in advance!!
> > > >
> > > >
> > > > ---- Bill Deegan <bill at baddogconsulting.com> wrote:
> > > > > Spencer,
> > > > >
> > > > > Greetings and welcome!
> > > > >
> > > > > So the underlying packages already had a SCons based build system?
> > > > > Or did you generate one for each package and then are trying to wrap
> > them
> > > > > with a SConstruct on top?
> > > > >
> > > > > Also what platform? Which version of python? Which version of SCons?
> > > > >
> > > > >
> > > > > -Bill
> > > > >
> > > > > On Fri, Apr 21, 2017 at 1:22 PM, Spencer Yost <syost at triad.rr.com>
> > > > wrote:
> > > > >
> > > > > > I am setting up a new development environment for work, and I am
> > > > seriously
> > > > > > looking at SCons as a replacement for our Frankenstein build system
> > > > that we
> > > > > > currently have. I like what I see so far but I'm having some
> > trouble
> > > > > > understanding the underlying architecture.
> > > > > >
> > > > > > Note1:  I have been experimenting quite a bit, and I have read the
> > > > users
> > > > > > guide and man pages
> > > > > >
> > > > > > Note 2:  I'm an experienced C and C++ developer  but I've never
> > touched
> > > > > > Python  before.
> > > > > >
> > > > > > Note 3:  Our code base has approximately 10K-15K files, found in
> > > > several
> > > > > > hundred packages in a hierarchical reverse domain organization.
> > This
> > > > is
> > > > > > set up in one git repository.
> > > > > >
> > > > > > So I installed Scons on my Ubuntu laptop and SCons builds a lot of
> > > > > > packages out of box quite nicely.
> > > > > >
> > > > > > But some files and packages need to be treated specially before
> > they
> > > > can
> > > > > > be built.   The Sconstruct  file (originally generated by
> > > > SConsolidator in
> > > > > > eclipse) appears like scons will look for sconscript files  in each
> > > > > > individual package, but it doesn't.  Any SConscript file I place
> > in an
> > > > > > individual package for extra processing, does not appear to be
> > read.
> > > > > >
> > > > > > The only way I seem to be able to build a package with an
> > SConscript
> > > > file
> > > > > > is to also create an SConstruct file, and build using that package
> > as
> > > > my
> > > > > > current base directory.
> > > > > >
> > > > > >
> > > > > > Am I mistaken? Should I not be able to include a separate
> > SConscript
> > > > file
> > > > > > in each package for the individual needs of the individual package
> > yet
> > > > > > initiate the build from the top of the hierarchy?
> > > > > >
> > > > > > Thanks in advance!
> > > > > >
> > > > > > PS:  Same thing happens if I try to build from Eclipse with
> > > > SConsolidator.
> > > > > >
> > > > > > Spencer Yost
> > > > > > _______________________________________________
> > > > > > 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
> >



More information about the Scons-users mailing list