Re: Build problems - Mailing list pgsql-patches

From Tom Lane
Subject Re: Build problems
Date
Msg-id 24053.1085326829@sss.pgh.pa.us
Whole thread Raw
In response to Build problems  (Manfred Koizar <mkoi-pg@aon.at>)
List pgsql-patches
Manfred Koizar <mkoi-pg@aon.at> writes:
> Here is what I get without that change:

> gcc -O2 -g -Wall -Wmissing-prototypes -Wmissing-declarations
> -I/m/u2/home/fred/pgsrc/SNAP/tst04a/src/interfaces/libpq
> -I../../../src/include -I/m/u2/home/fred/pgsrc/SNAP/tst04a/src/include
> -D_GNU_SOURCE  -DFRONTEND  -c -o psqlscan.o
> /m/u2/home/fred/pgsrc/SNAP/tst04a/src/bin/psql/psqlscan.c -MMD
> psqlscan.l:40: psqlscan.h: No such file or directory
> psqlscan.l:46: common.h: No such file or directory
> psqlscan.l:47: settings.h: No such file or directory
> psqlscan.l:48: variables.h: No such file or directory
> make[3]: *** [psqlscan.o] Error 1

This seems extremely odd.  Why would only psqlscan.c fail this way?
All the other .c files in src/bin/psql include these same headers in
the same way.  And why does it fail for you but not for me, when we're
both using gcc?

The reason that a -I$(srcdir) should not be necessary is that gcc is
defined to automatically search the directory that the current input
file came from.  You can find this mentioned in passing in the
documentation of the -I- command line option; apparently it's
sufficiently standard behavior that the gcc authors felt no need to say
it more prominently.  I do find the same behavior defined explicitly in
the man page for HPUX's cpp:

     -Idir          Change the algorithm for searching for #include files
                    whose names do not begin with / to look in dir before
                    looking in the directories on the standard list.  Thus,
                    #include files whose names are enclosed in double
                    quotes ("") are searched for first in the directory of
                    the file containing the #include line, then in
                    directories named in -I options in left-to-right order,
                    and last in directories on a standard list.  For
                    #include files whose names are enclosed in angle
                    brackets (<>), the directory of the file containing the
                    #include line is not searched.  However, directory dir
                    is still searched.

I think the actual problem is someplace else.  Maybe your version of
flex is doing something weird when it generates psqlscan.c?  What do
the #line directives look like in that file?

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Build problems
Next
From: Tom Lane
Date:
Subject: Re: Cancel/Kill backend functions