[Scons-users] Build Order

Russell, J.J. russell at slac.stanford.edu
Sun Jul 13 15:26:12 EDT 2014


I’ll try to cut this example down to the minimum.  In the meantime, I’ve narrowed the issue to the symbolic links that are links, not to files, but to directories that I am having trouble with.  Even though I pass the stem of that include path to the C code, if the symbolic has not been created, the C scanner wouldn’t be able to locate the include file as a dependency.  That is the scanner will try all the include paths and none will locate the file. 

Here is a rough outline.  In the C file is something that looks like

   #include “test-pkg/platform/atomic_ops.h”

The CPPPATH includes a reference to a directory that looks like

      <platform-specific-stem>/inc/test-pkg/platform

where platform is a symbolic link, that dependent on the target platform, points to one of a number of directories that contain platform dependent code, for example

     <platform-specific-stem>/inc/test-pkg/platform ->  <project-stem>/test-pkg/inc/linux-x86_64  ..or..
                                                                                    <project-stem>/test-pkg/inc/rtems-armCA9 … etc…

(The platform selection is done when the user invokes scons.  The motivation for this is to keep the platform selection out of the C code avoiding the usual #ifdef preprocessor method, but instead using the include paths to do the steering and to keep the number of include paths to as few as possible. I think ‘boost’ attempts a similar tactic.)
 

 So in this case, a CPPPATH that looks like
       CPPPATH = <platform-specifiic-stem/inc>

The problem is the that the symbolic link <platform-specific-stem/inc/test-pkg/platform sometimes does not exist yet when the code is compiled.

I do not want to make every C file dependent on every included file, but I am wondering if what you are suggesting is just make it dependent on the existence of the CPPPATHs and the symbolically linked directories. That seems promising and I will try it.  Still not quite what I want, since at the SConscript level, I don’t know which of these symbolically linked directories any given piece of code uses.  Note that there are other symbolically linked directories in addition to ‘platform’.

As you may have surmised, I am a minimalist.  Having worked in medical and other safety conscious fieids, I grew to distrust search paths. They create unstable builds. It is not that they didn’t find a target (what I call fatal, but not serious; the build failed, just fix it), it is that they sometimes find the wrong target ( serious but not fatal, i.e. it built, but unless you look carefully, it is not what you wanted).

JJ



On Jul 12, 2014, at 10:48 PM, <scons-users-request at scons.org> <scons-users-request at scons.org> wrote:

> Date: Sat, 12 Jul 2014 23:33:57 +0200
> From: Dirk B?chle <tshortik at gmx.de>
> To: scons-users at scons.org
> Subject: Re: [Scons-users] Build Order
> Message-ID: <53C1A9C5.9010101 at gmx.de>
> Content-Type: text/plain; charset=windows-1252; format=flowed
> 
> Hello Jim,
> 
> On 12.07.2014 20:29, Russell, J.J. wrote:
>> Before compiling some C code, an include directory which that code uses needs to be populated.  I?ve written a builder to do this populating, but, because SCons controls the build order, there is no guarantee that the include directory will be populated when needed by the Object builder.
> 
> it should just work...if your Builder correctly returns the list of 
> copied targets in the include directory (you might need an Emitter for 
> this), and the CPPPATH variable points to your includes, such that they 
> get detected as implicit dependencies by SCons.
> Then it *is* guaranteed that the required headers get copied before a 
> target's build.
> 
> So I'm wondering why you think you need additional methods like Requires 
> or Depends. But maybe I'm missing something. Do you have something like 
> a simple example (SConstruct + Builder) that you can post?
> 
> Best regards,
> 
> Dirk



More information about the Scons-users mailing list