include path problems, or cons vs. make incompatability?
From:
Brian O'Keefe
Subject:
include path problems, or cons vs. make incompatability?
Date:
Fri, 23 Feb 2001 15:53:13 -0500
I've read through the discussion archive, and I see questions similar to
what my problem is, but I don't see something exactly, so here's my
question:
I'm using cons 2.0.1 on Red Hat Linux 6.2.
I've got a directory and subdirectory of code that I'm converting to use
cons rather than make. This source code is set up such that some of its
own .h files are actually "replacements" (at compile time only)
for some .h files in /usr/include/rpc/.
So, my sandbox is set up like ~/src/dirA/rpc/ and my build (and export)
directory is ~/export/linux/src/dirA/rpc/. My Conscript file lives in the
rpc/ directory. One of the .c files in the rpc/ directory includes
<netdb.h> which in turn includes <rpc/netdb.h>. In my rpc/
directory also lives a netdb.h file and it is the intention of this bunch
of code for this netdb.h file to get picked up by the include of
<rpc/netdb.h> from the /usr/include/netdb.h file during
compilation. However, cons causes the /usr/include/rpc/netdb.h file to be
picked up instead, which causes a failure since my .c file expects the
file in its own directory instead.
Using its normal make procedures, the search for <rpc/netdb.h>
starts down in my dirA/ directory, and thus finds the proper netdb.h file
in my own rpc/ directory, and things are OK. Here is the output from the
make:
#include "..." search starts here:
#include <...> search starts here:
..
/usr/i386-redhat-linux/include
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
/usr/include
End of search list.
So, does cons work differently than make in this respect, or do I
just have cons set up incorrectly? Here is the output from my cons
attempt:
gcc -D_POSIX_SOURCE -DUSE_INTTYPES -DNO_T_TYPES
-Iexport/linux/include -I~/src/dirA -c export/linux/src/dirA/rpc/myfile.c
-o export/linux/src/dirA/rpc/myfile.o
In file included from /usr/include/rpc/netdb.h:30,
from export/linux/src/dirA/rpc/myfile.c:65:
/usr/include/rpc/netdb.h:121: parse error blah blah blah
and then the rest are parsing errors within /usr/include/rpc/netdb.h
due to myfile.c not finding what it expects to find. You can see that it
is looking in /usr/include/rpc/netdb.h rather than the desired
...../src/dirA/rpc/netdb.h.
Any ideas? Do I just have my include path wrong? The first of the two -I
paths shown in the above output is defined in my top level Construct
file, and the second -I path is defined in my Conscript file.