[Scons-users] Error while refreshing build settings
Russel Winder
russel at winder.org.uk
Thu Feb 14 13:34:52 EST 2013
On Wed, 2013-02-13 at 22:04 -0500, Michael Potter wrote:
[…]
> After rearranging the code, I am having other problems and decided to
> make a mini version of my code to test with. I have attached that as
> a .zip file. If you care to reproduce the problems I am having you
> can use it to test. What I am doing that is unusual is generating
> code AND using VariantDir().
I have to say I would not structure the project in this way. I think you
have an extra level of directories adding to the complexity that is not
needed.
Unless you need to keep the generated source I would not have a
directory under source for it.
> I started to move my code around and am not stuck with a problem
> compiling on the command line. I have to resolve that before figuring
> out what is wrong with Eclipse.
What is wrong with Eclipse is a very long list indeed, but I suspect we
do not want to go there :-)
Are you using SConsolidator to use SCons in Eclipse?
> Here is the error I am getting when doing the out-of-source build:
>
> [pottmi at CentOS6-3 sconstest]$ scons -u
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> gcc -o build/src/diamond.o -c -I. -Isource build/src/diamond.c
> build/src/diamond.c:3:26: error: gensrc/joker.h: No such file or directory
> build/src/diamond.c: In function 'main':
> build/src/diamond.c:7: error: 'joker' undeclared (first use in this function)
> build/src/diamond.c:7: error: (Each undeclared identifier is reported only once
> build/src/diamond.c:7: error: for each function it appears in.)
> scons: *** [build/src/diamond.o] Error 1
> scons: building terminated because of errors.
You do not have the generated joker.h in the build tree so it is not
being created and hence the compilations fail. You need to ensure
joker.h is listed as a dependency of the compilation products.
> Here is a successful run doing an in-source build:
> [pottmi at CentOS6-3 sconstest]$ scons -u
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> make_define(["source/gensrc/joker.h"], ["source/src/joker.txt"])
> gcc -o source/src/diamond.o -c -I. -Isource source/src/diamond.c
> gcc -o source/src/queen.o -c -I. -Isource source/src/queen.c
> gcc -o source/diamond source/src/diamond.o source/src/queen.o
> scons: done building targets.
To be honest I have no idea why this worked!
(But that may be that I didn't look for long enough.)
> Once the in-source build runs, the out-of-source build will work
> (because the code is generated):
> [pottmi at CentOS6-3 sconstest]$ scons -u
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> gcc -o build/src/diamond.o -c -I. -Isource build/src/diamond.c
> gcc -o build/src/queen.o -c -I. -Isource build/src/queen.c
> gcc -o build/diamond build/src/diamond.o build/src/queen.o
> make_define(["build/gensrc/joker.h"], ["build/src/joker.txt"])
> scons: done building targets.
This is just a side effect of not having cleaned things first.
Personally I am not sure having in-tree builds is worth worrying about,
just support out-of-tree builds.
> SConstruct for in-source build:
> SConscript('source/SConscript')
>
> SConstruct for out-of-source build:
> VariantDir('build', 'source')
> SConscript('build/SConscript')
I think the last line should always be:
SConscript('source/SConscript')
I had a play with your files, rearranged, and made work as I would want
it. This may of course bear no relationship to what you actually want to
do :-)
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sconstest_rw.zip
Type: application/zip
Size: 1959 bytes
Desc: not available
Url : <http://four.pairlist.net/pipermail/scons-users/attachments/20130214/fa508884/attachment.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : <http://four.pairlist.net/pipermail/scons-users/attachments/20130214/fa508884/attachment.pgp>
More information about the Scons-users
mailing list