SCons / scons

SCons - a software construction tool
http://scons.org
MIT License
2.09k stars 315 forks source link

checkHeader fails to search current directory #1769

Open bdbaddog opened 6 years ago

bdbaddog commented 6 years ago

This issue was originally created at: 2007-11-02 06:49:04. This issue was reported by: rhl. rhl said at 2007-11-02 06:49:04

(This is copied from the dev@scons.tigris.org list where more details may be found. The consensus was that this was a bug. The obvious fix is to add . to CPPPATH if the delimiters are set to "" not <>, but this seems like a bit of a hack).

The CheckXXX commands fail to include . in the relevant paths; on os/x using gcc 4.0.1 this is a problem as the compile line looks something like

gcc -o .sconf_temp/conftest_1.o -c .sconf_temp/conftest_1.c

and gcc doesn't search the parent directory.

Here's an example SConstruct file. foo.h is empty; foo.c looks like:

void nowt() {}

If you remove the "."s from the Environment, the Check tests fail (run scons twice; the first time libfoo.a is built).

import os, sys

env = Environment(CPPPATH=".", LIBPATH=".")

conf = env.Configure()

hfile = "foo.h"
if not conf.CheckHeader(hfile, '""'):
    print("Failed to find/use %s" % hfile)
    sys.exit(1)

lib = "libfoo.a"
if not os.path.isfile(lib):
    Library("foo", "foo.c")
else:
    if not conf.CheckLib(lib):
        print("Failed to find/use %s" % lib)
        sys.exit(1)

gregnoel said at 2008-05-30 16:27:13

Bug party triage: Config programs should be run in the top directory (as GNU configure does). Gary and Greg to discuss implementation strategy for this and other issues related to revamping platform and tool configuration.

gregnoel said at 2008-06-04 18:15:02

Collect toolchain configuration issues under a single keyword

gregnoel said at 2008-07-27 03:45:00

Change all toolchain issues to enhancements scheduled for future p1.

gregnoel said at 2008-11-21 16:38:28

Consolidate toolchain issues as 2.x p3.

gregnoel said at 2008-12-26 13:20:23

Adjust triage of issues.

mwichmann commented 1 year ago

In my opinion, the Configure logic is to detect the usability of external libs and headers - system and 3rd party. not for the project's own libs and headers.