Skip to content

"No such file or directory" error on specific C++ project structure with suffix-free custom builder #2521

Open

Description

@bdbaddog

This issue was originally created at: 2009-11-16 20:09:36.
This issue was reported by: lxzhang.

lxzhang said at 2009-11-16 20:09:36

Hi,

I encountered this error while writing a build project to run unit tests for a C++ project, where a result file should be generated for each .cpp file, and then for each module, all result files should be summarised up.

I've attached a sample project to reproduce the error, on Windows it looks like this:

D:\project>scons -Q
unitTestAction(["app\application"], ["app\application.cpp"])
summaryAction(["app\app.txt"], ["app\application"])
summaryAction(["util\util.txt"], ["util\calc\calc"])
scons: *** [util\util.txt] util\calc\calc: No such file or directory

Project layout and brief descriptions as follows:

Layout                      Description
-----------------------     -----------------------
project
|   sconstruct              CPPPATH=['#util'], custom builder with 
"SourceFileScanner" but without "suffix"
+---app
|       application.cpp     #include "util.h"
|       sconscript          CPPPATH += ['#util/calc'], build '*.cpp'
\---util
    |   sconscript          build '*/*.cpp'
    |   util.h              #include "calc/whatever.h"
    \---calc
            calc.cpp        (empty, this file is missing from the build)
            whatever.h      (empty)

The error occurs both on Linux (SLES 10) and on Windows (XP). Python version is 2.5 (2.5.2 on Linux and 2.5.1 on Windows.)

Thanks.

lxzhang said at 2009-11-16 20:11:09

Created an attachment (id=655) sample project to reproduce: "No such file or directory" error on specific C++ project structure with suffix-free custom builder

gregnoel said at 2010-01-18 14:57:59

Bug party triage.

gregnoel said at 2010-07-21 16:58:11

Bug party triage. Bump this issue to P1 so it will be reviewed at next bug party.

dirkbaechle said at 2011-05-10 13:48:00

Hi, under my Linux box (Ubuntu 11.04) I get the following error with SCons v2.1.0.alpha (r5178):

  scons: Reading SConscript files ...
  scons: done reading SConscript files.
  scons: Building targets ...
  unitTestAction(["app/application"], ["app/application.cpp"])
  summaryAction(["app/app.txt"], ["app/application"])
  app/app.txt
  app/application
  unitTestAction(["util/calc/calc"], ["util/calc/calc.cpp"])
  scons: *** [util/calc/calc] util/calc/calc: Is a directory
  scons: building terminated because of errors.

When I change the second line in util/SConscript from

  env.Summary('util', env.UnitTest(Glob('*/*.cpp')))

to

  env.Summary('util', env.UnitTest('calc.sum', Glob('*/*.cpp')))

the build works fine. It looks as if unit/calc/calc is created as a directory when no explicit target for env.UnitTest() is specified...

Best regards,

Dirk

wblevins001 said at 2016-02-19 15:10:11

According to Dirk's comment, it looks like this issue should be closed?

bdbaddog said at 2016-02-24 07:49:39

I beleive it's a bug.
I tried added some other directories/files of the form

a/a.cpp
xyz/xyz.cpp

And the issue only happens with calc/calc.
Even with the Summary... call commented out.
If I rename calc/calc.cpp to calc/calcx.cpp the problem goes away.
It seems strangely as if SCons is somehow treating calc/calc differently.

I'll dig a little further.

bdbaddog said at 2016-02-27 17:39:50

I have a fix. I'll bring discussion to dev mailing list.

bdbaddog said at 2016-02-28 19:46:06

I have a patch, but I'm working to get a small test case to make sure I understand all the implications of the patch, and the exact method which triggers this error.

lxzhang attached project.zip at 2009-11-16 20:11:09.

sample project to reproduce: "No such file or directory" error on specific C++ project structure with suffix-free custom builder

Activity

  1. added this to the milestone on Jan 2, 2018
  2. added
    has patch
    on Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions