configure: error: C++ preprocessor “/lib/cpp” fails sanity check
Hello,
If you having trouble compiling any application manually using “configure” , here simple fix for this error.
Error ::
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
Solution::
- Centos/Fedora/RHEL
yum install gcc gcc-cpp gcc-c++
- Ubuntu/Debain
apt-get install gcc gcc-cpp gcc-c++
Regards
AlexP



















Hi,
I have similar problem with RHEL-4 Update6 when trying to install httpd-2.2.0.
I have Acer G540 Server with RHEL 4 Update 6 + Oracle 10 g Installed. Some applications required web server and i have downloaded httpd-2.2.0 and installed with the following configure option.
#configure –enable-so
I received the following error at the end…
————————————————-
checking how to run the C preprocessor… /lib/cpp
configure: error: C preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details.
configure failed for srclib/apr
————————————————–
I have gcc-3.4.3EL4 and gcc-c++-3.4.3-9EL4 installed
#c++ -v or g++ -v gives the following result:
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-java-awt=gtk –host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
# rpm -qa | grep c++ gives the following:
compat-libstdc++-33-3.2.3-47.3
gcc-c++-3.4.6-9
compat-libstdc++-296-2.96-132.7.2
gcc4-c++-4.1.2-14.EL4
compat-gcc-32-c++-3.2.3-47.3
libstdc++-3.4.6-9
libstdc++-devel-3.4.6-9
# ls -l /lib/cpp Gives the following
lrwxrwxrwx 1 root root 14 Sep 18 2008 /lib/cpp -> ../usr/bin/cpp
———————————————————————–
Below is the entire out put of configure –enable-so command:
root|C:/usr/local/httpd-2.2.0> ./configure –enable-so
checking for chosen layout… Apache
checking for working mkdir -p… yes
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
Configuring Apache Portable Runtime library …
checking for APR… reconfig
configuring package in srclib/apr now
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
Configuring APR library
Platform: i686-pc-linux-gnu
checking for working mkdir -p… yes
APR Version: 1.2.2
checking for chosen layout… apr
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ANSI C… none needed
Applying APR hints file rules for i686-pc-linux-gnu
setting CPPFLAGS to “-DLINUX=2″
adding “-D_REENTRANT” to CPPFLAGS
adding “-D_GNU_SOURCE” to CPPFLAGS
(Default will be unix)
checking whether make sets $(MAKE)… yes
checking how to run the C preprocessor… /lib/cpp
configure: error: C preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details.
configure failed for srclib/apr
—————————————————————
I tried the net and our linuxQuestions.org but no particular solution for RHEL…
Kindly someone help me to solve the problem please…
Thanks & Regards,
Mohanraj.S
Hello Mohanraj,
Could you please try to reinstall gcc, gcc-c++, cpp package as well as all relative dependencies.
Hope it will be work after that,Still if you have any issue let me know.
Regards
Alex P
@Alex P
Hi Alex,
Thanks for the suggession… in our organisation we have similar server & almost (ALMOST) same configuration in 30 locations and in some of the server it was installing w/o problem… and only in some server it creating problem… so I asked the respective admins about the LINUX installation and where ever there is no problem they had installed “every thing” from the CD.. where ever there is problem it was “custome” installation… so I figured out the problem and installed the folliwng:
glibc-kernheaders
glibc-headers
glibc-common
glibc-profile
glibc-utils
glibc
gclibc-devel
since it was the problem with c compiler… i randomly installed all glibc things from the CD… then i compile httpd-2.2.0 and configured… this time it was very well OK….
Thanks for all for the suggessions
-Mohanraj.S
Thanks, this has really helped me in installing ProFTPd, great post!
Hi All!
Please check this files:
/usr/include/sys/
My problem was that!!!
Regards: Vinicius (Danone)
Thanks for the solution!