gccbuildcygwin

GCC 4.6.0 build sanity check error


So I"m building GCC 4.6.0 in Cygwin, but I've hit a wall. I try to configure gcc from a build directory on the same level as gcc-4.6.0 directory I get this:

configure: error: in `/usr/local/contrib/gcc-build/gcc':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[2]: *** [configure-stage1-gcc] Error 1
make[2]: Leaving directory `/usr/local/contrib/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/local/contrib/gcc-build'
make: *** [all] Error 2

I checked in the config.log and here's what it says:

conftest.c: In function `main':
conftest.c:16: error: `choke' undeclared (first use in this function)
conftest.c:16: error: (Each undeclared identifier is reported only once for each function it appears in.)
conftest.c:16: error: parse error before "me"

What does this error mean? What can I do to fix it?


Solution

  • tl;dr - First, there's a Wikia page for this (just revised it too). If you are trying to build the c++ compiler (typically using "--enable-languages=c,c++") ensure you've installed the gcc-g++ package! Without it your build will fail in the way you are seeing.

    EDIT 2: I revised that Wikia page after successfully building GCC 4.6.0 (C and C++ targets) a little while ago.

    First, your post is a bit old so if you figured it out, please let us know!

    What set of instructions are you using to build this? I'm working through this myself using this wiki page and I hit the same exact wall. Did you look at the config.log file in the folder you are building in? What's it saying what's going wrong? For me it's missing *ppl_c.h*, which I'm trying to track down now, and I'm also getting a repeated error of "cannot exec 'cc1plus'". Because this is configure some of this might be normal - maybe all of it is (a failed check can simply mean an alternate method will be used). I intend to try 4.3.0 next to see if that works and what the config.log looks like in comparison.

    EDIT 1: Install gcc-g++! That will clear the cc1plus hurdle.

    My setup, for the record (Note: my host OS is Windows 7 x64):

    The core Cygwin packages I'm using are the most current ones (non-experimental):

    $ cygcheck -c bash binutils bzip2 gcc-core gcc-java  gzip m4 make unzip zip
    
    Cygwin Package Information
    Package              Version        Status
    bash                 4.1.10-4       OK
    binutils             2.20.51-2      OK
    bzip2                1.0.6-1        OK
    gcc-core             3.4.4-999      OK
    gcc-g++              3.4.4-999      OK
    gzip                 1.4-1          OK
    m4                   1.4.16-1       OK
    make                 3.81-2         OK
    unzip                6.0-10         OK
    zip                  3.0-11         OK
    

    The packages I've got for GCC in particular, in the order built and installed:

    gmp-5.0.2
    mpfr-3.0.1
    mpc-0.9
    gcc-4.6.0 (trying to build "c,c++" targets only)
    

    Paths are set correctly (at least per the instructions above):

    LD_LIBRARY_PATH=/usr/local/lib
    LIBRARY_PATH=/usr/local/lib
    CPATH=/usr/local/include