11

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 ???

3
  • This could help: stackoverflow.com/questions/8097442/… Commented Jun 19, 2013 at 4:34
  • how to search the SConstruct file in scons Commented Jun 19, 2013 at 4:38
  • @user2439278 it's probably a bit late, but can you accept below answer (if it was helpful)? This will mark the question as resolved and help other users. Commented Apr 26, 2017 at 20:16

1 Answer 1

17

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 
Sign up to request clarification or add additional context in comments.

3 Comments

could you please explain with example.. I had created and stored SConstruct.py in /usr/local/lib/scons-2.3.0/SCons/.
im new to this.please help me to fix this issue
@user2439278 Ok, I will update the answer with an example. But when I refer to a project, Im referring to the source code project, not the SCons installation project.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.