[Date Prev][Date Next] [Chronological] [Thread] [Top]

include directory order leads to problems (ITS#2598)



Full_Name: Wout van Albada
Version: 2.1.21
OS: Solaris 8
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (146.50.4.94)


The build phase of OpenLDAP 2.1.21 failed while compiling the file
libraries/libavl/avl.c because it included the wrong avl.h. There was an avl.h
elsewhere on the system which came first. This is because OpenLDAP's own include
directory is listed AFTER the "standard system" include directories in the
Makefiles.
This is quite easy to fix, but should probably be fixed by changing the order of
the include directories in all the Makefile.in files.

Here's how I set up openldap:

./configure                             \
            --prefix=/opt/arch/openldap-2.1.21  \
            --enable-debug                      \
            --disable-ipv6                      \
            --enable-slapd                      \
            --enable-cleartext                  \
            --enable-crypt                      \
            --enable-slurpd                     \
            --with-tls

make depend
make

Then while compiling libraries/libavl.c:

cc -xO5  -I/usr/local/include -I/usr/local/gnu/include  -L/usr/local/lib
-L/usr/local/gnu/lib  -R/usr/local/lib -R/usr/local/gnu/lib -I../../include
-I../../include   -I/usr/local/include -I/usr/local/gnu/include 
-L/usr/local/lib -L/usr/local/gnu/lib   -c  avl.c
"avl.c", line 63: syntax error before or at: *
"avl.c", line 64: warning: undefined or missing type for: void
"avl.c", line 65: warning: undefined or missing type for: int
"avl.c", line 66: warning: undefined or missing type for: fcmp
"avl.c", line 67: warning: undefined or missing type for: fdup
"avl.c", line 68: warning: undefined or missing type for: int
.... (lots of errors deleted)

In my case, there exists a file /usr/local/gnu/include/avl.h which was included
by libraries/libavl/avl.c
If '-I../../include' was first in the list, this problem would not occur.

In the generated libraries/libavl/Makefile file, the following line controls the
order of the include directories:

CFLAGS = $(AC_CFLAGS) $(DEFS)

$(AC_CFLAGS) contains all the system include dirs, while $(DEFS) contains the
openldap include directory: -I../../include

Hope this is of use.