[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Ordering of "-I" flags in CPPFLAGS can lead to gnulib headers being skip
From: |
Michael Goffioul |
Subject: |
Ordering of "-I" flags in CPPFLAGS can lead to gnulib headers being skipped |
Date: |
Thu, 23 Feb 2012 10:08:09 +0000 |
Hi,
While trying to compile octave-3.6.1 with MSVC, I found a problem
related to the ordering of include paths in CPPFLAGS. For instance, in
liboctave/Makefile.am, the flags are defined as:
AM_CPPFLAGS = \
@CPPFLAGS@ -I../libgnu -I$(top_srcdir)/libgnu \
-I$(top_srcdir)/libcruft/misc
So if you call configure script like:
./configure .... CPPFLAGS="-I/my/special/path"....
the added include path will appear *before* gnulib headers. So if one
gnulib header is supposed to override one of the header in
/my/special/path, it'll fail as the original one will be picked up
first. This happened to me, as I have a version of dirent.h in
/my/special/path, which is picked first instead of gnulib dirent.h.
This eventually leads to a compilation failure in dir-ops.cc:
dir-ops.cc(56) : error C2039: 'opendir' : is not a member of 'gnulib'
dir-ops.cc(80) : error C2039: 'readdir' : is not a member of 'gnulib'
dir-ops.cc(98) : error C2039: 'closedir' : is not a member of 'gnulib'
I'm not sure where the error is:
1) CPPFLAGS should never contain any include path with headers that
gnulib is supposed to override
2) in liboctave/Makefile.am, @CPPFLAGS@ should be moved to the end, or
after "-I../libgnu"
3) ...?
Any suggestion?
Michael..
- Ordering of "-I" flags in CPPFLAGS can lead to gnulib headers being skipped,
Michael Goffioul <=