[Scons-users] Error while refreshing build settings
Michael Potter
pottmi at gmail.com
Fri Feb 15 17:37:46 EST 2013
I found a patch to my original problem (A dump while clicking the Swiss flag):
The 'None' came from SConsolidator not being able to determine my
compiler. It was looking for an environment variable CXX.
I added this line and the problem went away:
environment['CXX'] = 'gcc'
I don't think that is a good solution because scons does not need that
variable set. I think SConsolidator should use the same compiler as
scons.
I submitted a bug report to SConsolidator here:
http://sconsolidator.com/issues/35
--
potter
On Fri, Feb 15, 2013 at 8:13 AM, Michael Potter <michael at potter.name> wrote:
> Dirk,
>
> This is a _very_ important feature to me, so I want to get to the
> bottom of this.
>
> I did some more testing and It seems to work without the explicite
> dependency (see below).
> I added an additional line in the SConscript file for a header that is
> never referenced with an include. It did not build (good).
>
> Can you help me find a situation where the dependency would not be found?
>
> I am a newbie and appreciate your guidance on getting the best
> configuration possible.
>
> [pottmi at CentOS6-3 sconstest]$ scons -c
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Cleaning targets ...
> Removed build/joker.h
> Removed build/diamond.o
> Removed build/queen.o
> Removed build/diamond
> Removed directory build
> scons: done cleaning targets.
>
> [pottmi at CentOS6-3 sconstest]$ rm .sconsign.dblite
>
> [pottmi at CentOS6-3 sconstest]$ find . -type f
> ./.project
> ./SConstruct
> ./.cproject
> ./.in
> ./sconstest2.zip
> ./source/queen.h
> ./source/diamond.c
> ./source/joker.txt
> ./source/queen.c
> ./source/SConscript
>
> [pottmi at CentOS6-3 sconstest]$ scons build/diamond
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> make_define(["build/joker.h"], ["source/joker.txt"])
> gcc -o build/diamond.o -c -g -Ibuild -Isource source/diamond.c
> gcc -o build/queen.o -c -g -Ibuild -Isource source/queen.c
> gcc -o build/diamond build/diamond.o build/queen.o
> scons: done building targets.
>
> [pottmi at CentOS6-3 sconstest]$ cat SCon*
> buildDirectory = 'build'
> environment = Environment()
> environment.Append(CPPPATH='#' + buildDirectory)
> SConscript('source/SConscript', exports='environment',
> variant_dir=buildDirectory, duplicate=0)
> Clean('.', buildDirectory)
>
> [pottmi at CentOS6-3 sconstest]$ cat source/SCon*
> Import('environment')
>
> environment['CCFLAGS'] = '-g'
>
> def make_define(target, source, env):
> assert len(target) == 1
> assert len(source) == 1
> srcf = str(source[0])
> dstf = str(target[0])
> with open(srcf, "r") as f:
> contents = f.readline().rstrip()
> with open( dstf, "w") as outf:
> outf.write('#define joker "' + contents + '"')
>
> #environment.Command('joker.h', 'joker.txt', make_define)
>
> bld = Builder(action = make_define)
> environment.Append(BUILDERS = {'make_define': bld})
> environment.make_define('joker.h', 'joker.txt')
> environment.make_define('jokerX.h', 'joker.txt')
>
> #environment.Depends('diamond.o', 'joker.h')
> environment.Program('diamond', ['diamond.c', 'queen.c'])
>
>
>
>
> On Thu, Feb 14, 2013 at 6:43 PM, Dirk Bächle <tshortik at gmx.de> wrote:
>> Hi Michael,
>>
>> just a few comments from my side that hopefully help you with the further
>> setup of your project:
>>
>>
>> On 14.02.2013 20:45, Michael Potter wrote:
>>>
>>> On Thu, Feb 14, 2013 at 1:34 PM, Russel Winder <russel at winder.org.uk>
>>> wrote:
>>>>
>>>> On Wed, 2013-02-13 at 22:04 -0500, Michael Potter wrote:
>>>> […]
>>>>
>>> I have a #include "gensrc/joker.h" in diamond.c, so that should signal
>>> scons that it is a dependency. That dependency detection works if I
>>> do in-source build, but does not work if I do a out-of-source build.
>>
>>
>> Correct, for the in-source-tree build, SCons scans 'source/src/diamond.c' as
>> a child of 'source/src/diamond.o'. This file exists already and contains the
>> #include reference to 'joker.h', so SCons can pick the dependency up
>> automatically.
>> But for the out-of-source configuration it builds 'build/src/diamond.o' and
>> therefore tries to scan 'build/src/diamond.c', which isn't there yet. :(
>>
>>
>>> As a test, I removed this line from your proposed solution:
>>> environment.Depends('diamond.o', 'joker.h')
>>> Dependency detection still worked. So I think that line was redundant
>>> with the automatic dependency detection. That is good.
>>>
>>
>> My guess is, that so far you probably always did a full build (simply called
>> "scons" without specifying any targets) and were extremely lucky that
>> "joker.h" accidentally got built first in some cases.
>> Please try a
>>
>> scons build/diamond
>>
>> (specifying 'build/diamond' as the only target) for your out-of-source-tree
>> configuration, without an existing "joker.h". It can't work like that...you
>> really need to set an explicit dependency:
>>
>> joker = env.make_define('gensrc/joker.h', 'src/joker.txt')
>> env.Depends('src/diamond.c', joker)
>>
>> in order to provide enough info and get SCons started in all build cases.
>>
>> Best regards and "Happy SConsing",
>>
>> Dirk
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> http://four.pairlist.net/mailman/listinfo/scons-users
>
>
>
More information about the Scons-users
mailing list