[Scons-users] Implicit dependency file search
Nathan Paul Simons
MgA5Ge0b-scons at hardcorehackers.com
Wed Sep 11 15:50:29 EDT 2013
Thank you very much for that! That solves part of my problem; however,
SCons was still not finding system include headers. Digging a bit (this is
very preliminary - only tested against g++ 4.7.3 on Cygwin), I found in
SCons/Tool/g++.py a place to add some logic to ask GCC for its include
paths:
--- engine/SCons/Tool/g++.py 2013-03-03 06:48:40.000000000 -0800
+++ /usr/local/stow/scons-2.3.0/lib/scons-2.3.0/SCons/Tool/g++.py 2013-09-11 12:44:54.125418900 -0700
@@ -51,6 +51,7 @@
cplusplus.generate(env)
env['CXX'] = env.Detect(compilers)
+ env.AppendUnique(CPPPATH = get_internal_cpppath(env))
# platform specific settings
if env['PLATFORM'] == 'aix':
@@ -83,6 +84,36 @@
def exists(env):
return env.Detect(compilers)
+def get_internal_cpppath(env):
+ print "Get internal cpppath"
+ result = []
+
+ # Get the preprocessor that g++ is using.
+ pipe = SCons.Action._subproc(env, [env['CXX'], '-print-prog-name=cc1plus'],
+ stdin = 'devnull',
+ stderr = 'devnull',
+ stdout = subprocess.PIPE)
+ if pipe.wait() != 0: return result
+ cppcmd = pipe.stdout.readline().strip()
+
+ pipe = SCons.Action._subproc(env, [cppcmd, '-v'],
+ stdin = 'devnull',
+ stderr = subprocess.PIPE,
+ stdout = 'devnull')
+ if pipe.wait() != 0: return result
+ line = pipe.stderr.readline()
+ while line:
+ if line.find("#include <...> search starts here:") > -1:
+ line = pipe.stderr.readline().strip()
+ while line:
+ if line.find("End of search list.") > -1:
+ return result
+
+ result.append(line)
+ line = pipe.stderr.readline().strip()
+
+ line = pipe.stderr.readline().strip()
+
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
On Mon, Aug 05, 2013 at 10:44:25PM +0200, Julien Pommier wrote:
> It sounds like you are running into this issue:
>
> http://scons.tigris.org/issues/show_bug.cgi?id=2723
>
>
> On 5 août 2013, at 21:55, Nathan Paul Simons <MgA5Ge0b-scons at hardcorehackers.com> wrote:
>
> > On Wed, Jul 31, 2013 at 01:09:33AM +0200, Dirk Bächle wrote:
> >> On 31.07.2013 00:36, Nathan Paul Simons wrote:
> >>> I corrected those errors, and still have the same result; surprisingly,
> >>> I can only seem to reproduce the error under Cygwin. I'm still testing
> >>> things out, so I'll have to get back to you. Thanks!
> >>
> >> when you mention "Cygwin" this rings a bell in my head. Don't we
> >> always have trouble with native Python vs. the Cygwin version, or
> >> somethin'?
> >> Can you please give us some more details about how exactly your
> >> environment looks like?
> >> Which versions of Python and Cygwin are you using? OS is Windows, I suppose?
> >
> > Sorry for the late response; yes, it's under windows, with the Python
> > that comes with Cygwin (Python 2.7.3). I'm currently trying SCons 2.3.0,
> > but I've been having this problem for a while (since at least 2.2.0).
> > I've also tried on a Debian Linux box with Python 2.7.3 and SCons 2.3.0
> > and it seems to work there. Output of scons --tree=prune under Cygwin:
> >
> > scons: Reading SConscript files ...
> > scons: done reading SConscript files.
> > scons: Building targets ...
> > gcc -o subdir/hello.o -c -Isubdir subdir/hello.c
> > gcc -o subdir/hello.exe subdir/hello.o
> > +-.
> > +-SConstruct
> > +-subdir
> > +-subdir/hello.c
> > +-subdir/hello.exe
> > | +-subdir/hello.o
> > | | +-subdir/hello.c
> > | | +-/bin/gcc
> > | +-/bin/gcc
> > +-[subdir/hello.o]
> > +-subdir/SConstruct
> > scons: done building targets.
> >
> > Same thing under same versions in Debian:
> >
> > scons: Reading SConscript files ...
> > scons: done reading SConscript files.
> > scons: Building targets ...
> > gcc -o subdir/hello.o -c -Isubdir subdir/hello.c
> > gcc -o subdir/hello subdir/hello.o
> > +-.
> > +-SConstruct
> > +-subdir
> > +-subdir/SConstruct
> > +-subdir/hello
> > | +-subdir/hello.o
> > | | +-subdir/hello.c
> > | | +-subdir/hello.h
> > | | +-/usr/bin/gcc
> > | +-/usr/bin/gcc
> > +-subdir/hello.c
> > +-subdir/hello.h
> > +-[subdir/hello.o]
> > scons: done building targets.
> >
> > Perhaps it's an FS ordering or lookup problem? Had something similar a
> > while back on my current project when listing directory contents using
> > C's opendir() (with a compat header for dirent.h under Windows).
> >
> > --
> > Sent from my Universal Turing Machine
> > _______________________________________________
> > Scons-users mailing list
> > Scons-users at scons.org
> > http://four.pairlist.net/mailman/listinfo/scons-users
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
>
--
Sent from my Universal Turing Machine
More information about the Scons-users
mailing list