|
![](/i/fill.gif) |
The build problem reported by Tim has been solved, and I'd like
to thank him for reporting it and for the tests he did at my request.
A workaround should be implemented in the future version of the build
system of POV-Ray for Unix. This message is meant to serve as reference
in the mean time.
Short version:
The problem is _not_ due to the build system in POV-Ray for Unix
per se, but rather to the combination of:
- a particular setting in one environment variable
- a (seemingly) buggy behavior of the compiler used -- here gcc,
possibly affecting all versions.
The build failure is due to having the environment variable
C_INCLUDE_PATH set with a "." (current directory) in the list of
include paths, and gcc wrongly removing all duplicate "." entries.
Workaround: do not set C_INCLUDE_PATH (or any similar environment
variable used by the compiler) with the "." path. An (untested)
alternative is to build POV-Ray in a different directory than in
its source tree; see section 4.1.3 of the INSTALL file.
Long version:
Facts:
1) The build failure in the unix/ directory is the consequence of
unix/config.h not being read; the definitions contained therein
are thus missing and lead to compilation errors in other files.
2) Instead, a config.h file is read in another directory (here in
the 3rd-party zlib library in ../libraries/zlib). Using this
config.h file generates the warnings that appear before the
make errors.
Causes:
1) The C_INCLUDE_PATH environment variable is set for the user
(e.g. in his $HOME/.bash_profile configuration file) with
something like
C_INCLUDE_PATH=.:/home/user/include
where the first dot means the current directory. These paths
are normally used by the compiler to search for header files
included in C sources.
2) For compiling POV-Ray, several include paths are specified on
the compiler command-line using -Ipath flags. These flags are
normally prepended to the list of paths used to search for
include files. The compiler then searches for include files
in the following order:
1) all -Ipath specified at the command-line, in the given order;
2) paths specified through environment variables specified by
the user, in the given order;
3) default (system) search paths (unless the compiler is asked
not to search in system paths), in a system-specific order.
The -I. compiler flag is usually used when compiling each
source file.
3) For some unknown reason, the gcc (g++) compiler does the following
when compiling a C++ source file:
(tested in the unix/ directory using the -v compiler option,
simplified output)
g++ -I. -I. -I.. -I.. -I../source -I../source/base -I../source/frontend
-I../source -I../libraries/zlib -I../libraries/png -I../libraries/tiff/libtiff
-I../libraries/tiff/libtiff -I/usr/X11R6/include -v -c -o svga.o
`test -f 'svga.cpp' || echo './'`svga.cpp
<snip>
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
ignoring duplicate directory "."
as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "."
as it is a non-system directory that duplicates a system directory
ignoring duplicate directory ".."
ignoring duplicate directory "../source"
ignoring duplicate directory "../libraries/tiff/libtiff"
#include "..." search starts here:
#include <...> search starts here:
..
../source
../source/base
../source/frontend
../libraries/zlib
../libraries/png
../libraries/tiff/libtiff
/usr/X11R6/include
.
/home/user/include
/usr/include/c++/3.2.2
/usr/include/c++/3.2.2/i386-redhat-linux
/usr/include/c++/3.2.2/backward
/usr/local/include
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include
/usr/include
End of search list.
Note that gcc decides to completely remove the "." directory from
the search list of include files, while -I. was specified as the first
path to be searched (here twice: the second -I. is due to the fact that
the user builds POV-Ray directly in its source tree).
Apparently gcc removes "." because it considers that the "." given
in C_INCLUDE_PATH (here right before /home/user/include) is a system directory.
Also in principle C_INCLUDE_PATH should be ignored when compiling a C++ source
(the preprocessor should use CPLUS_INCLUDE_PATH instead).
As a result, the ./config.h file is not found for the C++ source file.
Instead the first config.h file found in the list above (in ../libraries/zlib
in this case) is used instead. The "." found in the search list is too low
in the list to be useful here. (On systems where compiling the 3rd-party
libraries is not required, the build could eventually succeed.)
Conclusion:
A possible workaround is to remove "." from the search list in C_INCLUDE_PATH.
Alternatively, one can build the POV-Ray source in another directory so as to
have gcc use a -Ipath refering to the unix/ directory by something else but
the "." path.
- NC
Post a reply to this message
|
![](/i/fill.gif) |