Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
950 views
in Technique[技术] by (71.8m points)

python - SCons- *** No SConstruct file found

Installed SCons using # cd scons-2.3.0 # python setup.py install

After Installation, when i try to run scons , got the below error.

scons: * No SConstruct file found. File "/usr/local/lib/scons-2.3.0/SCons/Script/Main.py", line 905, in _main

How to overcome this ???

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are 3 ways to specify the SConstruct file when using SCons, as follows:

  • Execute scons from the root of the project, where there should be a SConstruct file. This is the most standard way.

  • From a subdirectory of the project, where there should be a SConsctruct file at the root, execute scons with one of the following options (as seen by scons -h) to tell it to look up the directory structure for the SConstruct

-u, --up, --search-up
Search up directory tree for SConstruct, build targets at or 
below current directory.

-U
Search up directory tree for SConstruct, build Default() targets 
from local SConscript.
  • Explicitly specify where the SConstruct file is, this is also available from scons -h
-f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
Read FILE as the top-level SConstruct file.

Here is an example project in the directory /home/notroot/projectDir with the following directory structure:

SConstruct
subdir/file.hh
subdir/file.cc

Here is how to use the different options mentioned above:

Option 1:

Execute scons from the root project directory

# cd /home/notroot/projectDir
# scons

Option 2:

Execute scons from within the project directory and tell it to look up the dir hierarchy for the SConstruct

# cd /home/notroot/projectDir/subdir
# scons -u

Option 3:

Execute scons from within the project directory and specify the path of the SConstruct

# cd /home/notroot/projectDir/subdir
# scons -f /home/notroot/projectDir/SConstruct

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...