LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   GCC make error - lib/cpp fails sanity check (http://www.linuxquestions.org/questions/linux-from-scratch-13/gcc-make-error-lib-cpp-fails-sanity-check-913777/)

n1k0 11-16-2011 01:15 AM

GCC make error - lib/cpp fails sanity check
 
Hello. I am new to the forums, and I am in the middle of my first Linux From Scratch installation. I apologize in advance if this has been answered elsewhere, but I have been unable to find an answer either through google or on these forums for my specific question.

I am using version 7.0, and I am on chapter 6.17. My host system is Fedora 16. Up until now, everything has gone well, and all the tests and such have succeeded without error.

I am currently in a chrooted environment attempting the final install of GCC-4.6.1. When I attempt to issue the "make" command, I get the following error:

checking how to run the C preprocessor... /lib/cpp
configure: error: in `/sources/gcc-build/i686-pc-linux-gnu/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/sources/gcc-build'
make: *** [all] Error 2

I am not sure what information is relevant from my config.log, so I won't post it now (but just ask if anyone wants it). I have tried a few different times, and I even copy/pasted the commands to make sure there were no typos, but I still get the same error.

I installed the necessary packages before attempting the GCC install, and I made sure to use a clean gcc-build directory and not the same one from the earlier pass (two problems that apparently caused other users the same error in the past). I'm sorta new to this, and I have been unable to figure out on my own how to fix this.

Does anyone know what may be causing this and/or how to fix it?

Any help is greatly appreciated. Thank you for your time.

weibullguy 11-16-2011 02:12 AM

The configure script attempts to compile little snippets of code to check for the existence or operability of programs. This includes the compilers. If you look in config.log, you should be able to find the little snippet of code it was attempting to compile. There should be more information in that general vicinity as to what the problem is.

n1k0 11-16-2011 02:40 AM

Thank you for your reply! I checked the config.log. There were some "checking for x, result: no" (i.e. bison, etc), but I figure that's just because I haven't gotten to the part where you install those yet, since I know they are installed on the host system. I found this, though, and it seems to be the cause of the error/s:

gcc version 4.6.1 (GCC)
configure:4195: $? = 0
configure:4184: gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4195: $? = 1| }
configure:5764: result: no
configure:5778: checking for version 0.11 (revision 0 or later) of PPL
configure:5795: gcc -c -g -O2 conftest.c >&5
conftest.c:10:19: fatal error: ppl_c.h: No such file or directory
compilation terminated.

configure:4184: gcc -qversion >&5
gcc: error: unrecognized option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:4195: $? = 1
configure:4184: gcc -qversion >&5
gcc: error: unrecognized option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:4195: $? = 1
configure:4184: gcc -qversion >&5
gcc: error: unrecognized option '-qversion'
gcc: fatal error: no input files
compilation terminated.

configure:5755: $? = 1| }
configure:5764: result: no
configure:5778: checking for version 0.11 (revision 0 or later) of PPL
configure:5795: gcc -c -g -O2 conftest.c >&5
conftest.c:10:19: fatal error: ppl_c.h: No such file or directory
compilation terminated.

configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h. */
|
| /* Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
#endif
| char PWL_handle_timeout ();
| int
| main ()
| {
| return PWL_handle_timeout ();
| ;
| return 0;
| }
configure:5764: result: no
configure:5778: checking for version 0.11 (revision 0 or later) of PPL
configure:5795: gcc -c -g -O2 conftest.c >&5
conftest.c:10:19: fatal error: ppl_c.h: No such file or directory
compilation terminated.

------

So, admittedly having very little experience in this matter, it appears that there are a few different errors, i.e. passing the "-V" option, using the unrecognized '-qversion', a missing ppl_c.h file, and the failing confdefs.h.

I'm not sure what the "-V' option or '-qversion' mean, as I have been following the book exactly so far. Do you/anyone know why these options are either turned on or failing, and what course of action to take to address that? Ditto with the ppl_c.h file.

Secondly, regarding confdef.h, according to the conf.log, I just need to override the GCC internal prototype using "char" to avoid this error. Do you/anyone know how that can be done? Or maybe I just need to set all of those variables (PACKAGE_NAME, PACKAGE_TARNAME, etc.) somewhere...I didn't see anything regarding those in the documentation, though.

Thank you very much for your help. I know the answers are probably right in front of me, but being a noob, I can't quite figure them out.

weibullguy 11-16-2011 06:33 AM

ppl_c.h is provided by PPL which should not be needed to build gcc. The others aren't causing your problem either.

You should see "C preprocessor "/lib/cpp" fails sanity check" somewhere in config.log. Or is this the entire config.log. Find that area or post the entire config.log wrapped in "code" tags. Something went wrong with an earlier package. Could be many things. If you Google the actual error message, you will get dozens of results. The only way to know which applies to you is config.log.

No, you don't need to override anything. That is a comment in the test program configure is using. It's not telling you to do anything, it's telling you what it's doing.

n1k0 11-16-2011 01:56 PM

Hey weibullguy, thanks very much for your reply. The config.logs didn't tell me much and had no mention of the preprocessor. However, I checked under the libgcc directory and checked the config.logs there (I probably should have just checked there in the first place :redface:). It appears that I made an error while compiling glibc that apparently didn't show up until now.

Thankfully, I made a backup of the toolchain before adjusting it, and I was able to start over in chapter 6 and things went fine. Thanks again for pointing me in the right direction.

If anyone else has this problem, it helped to not just check the config.log but also the logs in the subdirectories and, like weibullguy advised, not just look for any error messages, but look for the specific message that caused the "make" fail, and then backtrack from there.


All times are GMT -5. The time now is 03:15 AM.