configure: error: C preprocessor fails sanity check

19,167

Solution 1

The problem may well be that the GNU make implicit variable that denotes "your C++ compiler" is not CPP but CXX, whereas CPP is the implicit variable that denotes "your C preprocessor"; so your

export CPP=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

tells configure that icpc is the preprocessor and leaves CXX presumably defaulting to g++.

This is supported by the ./configure error:

checking how to run the C preprocessor... /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

Try:

export CXX=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

or just:

./configure CXX=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

Solution 2

FWIW, I ran into this today and my solution was

export CPP='<path to icpc> -E'

that is, to tell configure that the preprocessor should be run with the -E flag.

Solution 3

Thanks Menno, in my case exporting didn't quite do it but it was close. Passing CPP=... to configure did the trick:

mkdir build
cd build
../configure --prefix=/usr/local/gcc/ CC=/usr/local/gcc/bin/gcc \
 CXX=/usr/local/gcc/bin/g++ CPP='/usr/local/gcc/bin/g++ -E'
Share:
19,167
RegedUser00x
Author by

RegedUser00x

Updated on July 21, 2022

Comments

  • RegedUser00x
    RegedUser00x over 1 year

    I am compiling several libraries on Ubuntu 12.04 x86_64. First I compiled the libraries with GCC 4.7.2 and it went all well. Then I tryed to recompile them with Inte Composer 2013 u2. Fot that purpose i did:

    export CC=/opt/intel/composer_xe_2013.2.146/bin/intel64/icc
    export CPP=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc
    

    Then I run ./configure and got the following error:

    checking how to run the C preprocessor... /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc
    configure: error: in `/var/www/workspace/freetype/freetype-2.4.11/builds/unix':
    configure: error: C preprocessor "/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc" fails sanity check
    See `config.log' for more details
    make: *** [setup] Error 1
    

    The config log file contains this error:

    configure:3345: checking how to run the C preprocessor
    configure:3415: result: /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc
    configure:3435: /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc  conftest.c
    conftest.c(14): error: identifier "Syntax" is undefined
                 Syntax error
                 ^
    
    conftest.c(14): error: expected a ";"
    
    compilation aborted for conftest.c (code 2)
    
    configure:3435: $? = 2
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME "FreeType"
    | #define PACKAGE_TARNAME "freetype"
    | #define PACKAGE_VERSION "2.4.11"
    | #define PACKAGE_STRING "FreeType 2.4.11"
    | #define PACKAGE_BUGREPORT "[email protected]"
    | #define PACKAGE_URL ""
    | /* end confdefs.h.  */
    | #ifdef __STDC__
    | # include <limits.h>
    | #else
    | # include <assert.h>
    | #endif
    |            Syntax error
    configure:3435: /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc  conftest.c
    conftest.c(14): error: identifier "Syntax" is undefined
                 Syntax error
                 ^
    
    conftest.c(14): error: expected a ";"
    
    compilation aborted for conftest.c (code 2)
    

    What can be wrong here?

  • wildplasser
    wildplasser over 10 years
    Good catch! (I overlooked it)
  • Daniele Testa
    Daniele Testa almost 4 years
    Sure, this solves the issue, but will force you to define the CPP variable every time you compile something. Why not explain how to compile GCC to look for CPP at the correct location in the first place?
  • Brian A. Henning
    Brian A. Henning almost 4 years
    Wow. This fixed it for me, too. So why does this wind up leading to "Syntax error" being inside the generated confdefs.h file? Talk about a red herring...
  • Alex
    Alex over 3 years
    This is many years later but THANK YOU. I would never have expected absolute path and -E flag to be necessary, but it was!!