0

I'm trying to build a project, which depends on Apache httpd. Unfortunately, I have and need the httpd sources to be in /usr/includes, while the project provides its own headers for httpd (of a different version!) in $(project)/common/includes. I want the gcc to pick up the headers from the project's directory instead of the /usr/includes, but I'm afraid that even if I'm successful with it, I will probably miss other important headers from /usr/includes.

Any ideas on how to do this?

EDIT: the relevant part of the Make file looks something like this:

CFLAGS = -Wall -O3 -fPIC -fomit-frame-pointer -I vm -D_GNU_SOURCE -I libs/common -D_64BITS
EXTFLAGS = -pthread
MAKESO = $(CC) -shared #-WBsymbolic

# later ...

all: createbin libneko neko std compiler libs

neko: bin/neko

# later ...

bin/neko: $(VM_OBJECTS)
    ${CC} ${CFLAGS} ${EXTFLAGS} -o $@ ${VM_OBJECTS} ${NEKOVM_FLAGS}
    strip bin/neko

Somewhere while executing this "recipe" I'm getting:

In file included from /usr/include/httpd/httpd.h:43:0,
                 from mod_neko.h:20,
                 from mod_neko.c:17:
/usr/include/httpd/ap_config.h:25:17: fatal error: apr.h: No such file or directory

But it shouldn't have used /usr/include/httpd/httpd.h because there's <project> /libs/include/apache2/httpd.h

Sergei Nikulov
  • 5,029
  • 23
  • 36
  • 1
    `CFLAGS=-I/common/includes`? – nneonneo Oct 02 '12 at 23:28
  • (Also worth pointing out that headers are strictly for the compiler; the linker does not use them.) – nneonneo Oct 02 '12 at 23:29
  • That will depend on a few things, whether CFLAGS are being overridden in Makefile, whether he uses Makefiles in general and if they are overridden, do they honor shell-set CFLAGS and in which order.. Need some more info to point precisely. – favoretti Oct 02 '12 at 23:36
  • It's not clear from your posting where the necessary headers are located. – alk Oct 03 '12 at 11:14

1 Answers1

0

Here the information about gcc includes search path

GCC looks in several different places for headers. On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with #include in:

 /usr/local/include
 libdir/gcc/target/version/include
 /usr/target/include
 /usr/include

You can add to this list with the -Idir command line option. All the directories named by -I are searched, in left-to-right order, before the default directories.

Sergei Nikulov
  • 5,029
  • 23
  • 36
  • @wvxvw I think you need to add -I $(project)/common/includes to your CFLAGS and it will be searched **before the default directories** – Sergei Nikulov Oct 03 '12 at 13:06
  • @wvxvw and also as per above comments -I$(project)/libs/include/apache2 should be added – Sergei Nikulov Oct 03 '12 at 13:16
  • @wvxvw I don't believe in magic. But if you've read my link "You can prevent GCC from searching any of the default directories with the -nostdinc option" – Sergei Nikulov Oct 03 '12 at 19:01