[Scons-users] Out of tree build getting "Source directory cannot be under variant directory" error
ethan09
ethanwwei at gmail.com
Thu Aug 23 16:43:38 EDT 2012
On Thu, Aug 23, 2012 at 1:27 PM, Evan Driscoll <driscoll at cs.wisc.edu> wrote:
> On 08/23/2012 03:21 PM, ethan09 wrote:
>> $ cat SConstruct
>> import os
>> vdir = os.getcwdu()
>> VariantDir(vdir, 'src')
>>
>> ...
>>
>> $ cd /home/users/<myid>/tmp/ # an empty directory
>> $ scons -f ../src/proj/SConstruct
>
> I haven't actually tried this, but I'm pretty sure that in this case,
> os.getcwdu() will *not* return your ~/<mvid>/tmp directory. Before
> reading an SConscript (including SConstruct), SCons chdirs to the
> directory that SConscript is in. Thus you're trying to set the bulid
> directory to src/proj.
Maybe this is the correct behavior, but I did try print what is
returned from os.getcwdu() and find it identical my launchdir. I am
using an old version on Ubuntu:
$ scons -v
SCons by Steven Knight et al.:
script: v2.0.1.r5134, 2010/08/16 23:02:40, by bdeegan on cooldog
engine: v2.0.1.r5134, 2010/08/16 23:02:40, by bdeegan on cooldog
> Try GetLaunchDir() instead: "Returns the absolute path name of the
> directory from which scons was initially invoked. This can be useful
> when using the -u, -U or -D options, which internally change to the
> directory in which the SConstruct file is found."
Thanks for the tip on GetLaunchDir() that I previously did not know about.
However changing os.getcwdu() to GetLaunchDir() didn't help my case.
The error message remains the same.
My worry is that SCons regards variant_dirs that is completely
detached from src_dir, as actually above the src dir.
>
> Evan
Thanks,
EW
More information about the Scons-users
mailing list