[Scons-users] Fwd: Help with scons: warning: No dependency generated for file: stdlib.h

Jason Fritz jasonfritzpublic at gmail.com
Tue Apr 8 13:42:19 EDT 2014


Hi all,

It seems the problem is related to turning on all warnings (specifically
the DependencyWarning class), but shouldn't that be a safe "best practice"?

Here's a simplified SConstruct that exhibits the same problem:
======== SConstruct begin ========
SetOption('warn','all')

Program('foo.cpp')
======== SConstruct end ========

Here is the source file:
======== foo.cpp begin ========
#include "stdio.h"

int main()
{
printf("Hello world\n");
return 0;
}
======== foo.cpp end ========

Here is the full output from SCons, including the warning:
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...

scons: warning: No dependency generated for file: stdio.h (included from:
foo.cpp) -- file not found
File "/usr/bin/scons", line 190, in <module>
g++ -o foo.o -c foo.cpp
g++ -o foo foo.o
scons: done building targets.


I see two ways to resolve this:
1) Somehow teach SCons how to find stdio.h, maybe by adding the standard
include dir to CPPPATH
2) Turn off the DependencyWarning class

Thanks for any help/advice!!!
- Jason



On Tue, Apr 8, 2014 at 10:58 AM, Jason Fritz <jasonfritzpublic at gmail.com>wrote:


> Hi Scons folks,

>

> I'm a new SCons user trying to convert an existing makefile-based build

> system to SCons. I'm having trouble with a bunch of SCons warnings about

> being unable to find all kinds of standard header files, e.g. stdlib.h,

> stdio.h, stdint.h, string.h, cassert.

>

> For example:

> scons: warning: No dependency generated for file: stdlib.h (included

> from: lib/common/dbglog/dbglog.h) -- file not found

> File "/usr/bin/scons", line 190, in <module>

>

> The strange thing is that the compiler (gcc) compiles the source code just

> fine. It is only SCons that is having trouble finding the files.

>

> Here are simplified versions of my SConstruct (top-level) and SConscript

> (5 levels deep in directory hierarchy).

>

> ======== SConstruct begin ========

> import sys

> SetOption('warn','all')

>

> cacheDir = '/local/mnt/workspace/.scons_cache'

> print 'CacheDir is: %s' % cacheDir

> CacheDir(cacheDir)

>

> releaseEnv = Environment()

>

> # Common C Preprocessor defines for all directories

> cppdefines = [

> ('LINUX',1),

> '_REENTRANT',

> '_GNU_SOURCE',

> '__ACE_INLINE__',

> 'ACE_HAS_AIO_CALLS',

> 'ACE_HAS_EXCEPTIONS',

> 'LINUXBTMAKE',

> 'USE_IOSTREAM'

> ]

> releaseEnv.Append(CPPDEFINES=cppdefines)

>

> # C/C++ compiler flags, other than include paths and C Preprocess defines

> ccflags = [

> '-mmmx', # Enable use of MMX instruction on i386/x86_64

> '-msse', # Enable use of SSE instruction on i386/x86_64

> '-msse2', # Enable use of SSE2 instruction on i386/x86_64

> '-Wall', # This enables all the warnings about constructions

> that some users consider questionable, and that are easy to avoid (or

> modify to prevent the warning), even in conjunction with macros

> '-g' # Produce debugging information in the operating

> system's native format

> ]

> releaseEnv.Replace(CCFLAGS = ccflags)

>

> # The debugEnv is a clone of the releaseEnv. The only difference is that

> # debugEnv is unoptimized to get stable debugger behavior.

> debugEnv = releaseEnv.Clone()

> releaseEnv.Append(CCFLAGS = '-O3') # Turn on max optimization for the

> release build

>

> # This is just an example... I'm not repeating the actual list

> includes_rtf_common = ['#/lib/abc', '#/lib/def']

>

> Export('releaseEnv debugEnv')

> Export('includes_rtf_common')

>

> # This includes a hierarchy of SConscript files which simply include the

> next layer down until the SConscript file listed below

> SConscript(['lib/SConscript'])

>

> ======== SConstruct end ========

>

> ======== SConscript begin ========

> Import('*')

> myReleaseEnv = releaseEnv.Clone()

> myReleaseEnv.AppendUnique(CPPPATH=includes_rtf_common)

>

> my_file = 'foo.cpp'

>

> myReleaseEnv.SharedLibrary('foolib', my_file)

> ======== SConscript end ========

>

> I'm using SCons v2.0.1 on RedHat Enterprise Linux 6.4 on x86_64 arch. I

> get the same behavior with Scons 2.3.1.

>

> Thank you for any help!

> Jason

>

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140408/c23f1fa5/attachment-0001.html


More information about the Scons-users mailing list