Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR] configure: error: C preprocessor "/lib/cpp" fails sanity check #327

Closed
M2shad0w opened this issue Jan 30, 2016 · 11 comments · Fixed by #330
Closed

[ERROR] configure: error: C preprocessor "/lib/cpp" fails sanity check #327

M2shad0w opened this issue Jan 30, 2016 · 11 comments · Fixed by #330
Assignees

Comments

@M2shad0w
Copy link

when i build crosstools-ng for esp8266, it raises this error, anyone help?

[ALL  ]    checking for suffix of object files... o
[ALL  ]    checking whether we are using the GNU C compiler... yes
[ALL  ]    checking whether  /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/xgcc -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/bin/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/lib/ -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/sys-include    accepts -g... yes
[ALL  ]    checking for  /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/xgcc -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/bin/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/lib/ -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/sys-include    option to accept ISO C89... unsupported
[ALL  ]    checking how to run the C preprocessor... /lib/cpp
[ERROR]    configure: error: in `/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/xtensa-lx106-elf/libgcc':
[ERROR]    configure: error: C preprocessor "/lib/cpp" fails sanity check
[ALL  ]    See `config.log' for more details.
[ERROR]    make[3]: *** [configure-target-libgcc] Error 1
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing pass-2 core C compiler'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@216]
[ERROR]  >>        called from: do_cc_core_backend[scripts/build/cc/gcc.sh@483]
[ERROR]  >>        called from: do_cc_core_pass_2[scripts/build/cc/gcc.sh@153]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@638]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/ct-ng.1.20.0/B - Known issues.txt'
[ERROR]
@bhundven
Copy link
Contributor

@jcmvbkbc Maybe you can take a look here?

@bhundven
Copy link
Contributor

@M2shad0w You also need to give us more information.

I have a math problem. The answer I got was 4. It's wrong. What is wrong with my math equation?

Can you think about my math problem and your issue and discover what you need to show us to help you?

@M2shad0w
Copy link
Author

i do as the article build ESP8266 dep env

step by step

but when i run command $ make STANDALONE=n

the process fails with error

[INFO ]  Installing pass-2 core C compiler
[ERROR]    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstddef:46:9: error: no member named 'ptrdiff_t' in the global namespace
[ERROR]    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:402:13: error: unknown type name 'ptrdiff_t'
[ERROR]    fatal error: too many errors emitted, stopping now [-ferror-limit=]
[ERROR]    make[4]: *** [graphite.o] Error 1
[ERROR]    make[4]: *** [graphite-blocking.o] Error 1
[ERROR]    make[3]: *** [all-gcc] Error 2
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing pass-2 core C compiler'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@216]
[ERROR]  >>        called from: do_cc_core_backend[scripts/build/cc/gcc.sh@483]
[ERROR]  >>        called from: do_cc_core_pass_2[scripts/build/cc/gcc.sh@153]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@638]

then do as this issue

Probably not the best solution, but this makes it compile:

In esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.2/gcc, add this line somewhere at the top:

#include <stddef.h>

of the following files:
graphite.c
graphite-blocking.c
graphite-clast-to-gimple.c
graphite-dependences.c
graphite-interchange.c
graphite-optimize-isl.c
graphite-poly.c
graphite-scop-detection.c
graphite-sese-to-poly.c

passed, but failed with above mention

[ERROR]    configure: error: in `/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/xtensa-lx106-elf/libgcc':
[ERROR]    configure: error: C preprocessor "/lib/cpp" fails sanity check

here is all the build log about 4M

image

@jcmvbkbc
Copy link
Contributor

jcmvbkbc commented Feb 1, 2016

@M2shad0w can you also share the file /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/xtensa-lx106-elf/libgcc/config.log ?

@M2shad0w
Copy link
Author

M2shad0w commented Feb 2, 2016

@jcmvbkbc thank you for your response

here is the config.log

@jcmvbkbc
Copy link
Contributor

jcmvbkbc commented Feb 2, 2016

@M2shad0w thanks.

So...

/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/xgcc -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/bin/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/lib/ -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/sys-include     -c -g -Os  conftest.c >&5
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/stdio.h:64:0,
                 from conftest.c:10:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/cdefs.h:707:2: error: #error Unsupported architecture
 #error Unsupported architecture

...for some reason the cross compiler tries to use host's include files through the libgcc configuration process. Let's try to find out why by invoking it with -v option so that it prints details of what it does. Can you do the following and post the output here?:

echo '#include <stdio.h>' > conftest.c
/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/xgcc -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-core-pass-2/./gcc/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/bin/ -B/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/lib/ -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include -isystem /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/sys-include   -v  -c -g -Os  conftest.c

@M2shad0w
Copy link
Author

M2shad0w commented Feb 3, 2016

@jcmvbkbc
the config test log is here https://gist.github.com/M2shad0w/3c149613f4295209b508

@jcmvbkbc
Copy link
Contributor

jcmvbkbc commented Feb 3, 2016

@M2shad0w OK, there are extra include directories. Looks like they are picked from the CPATH environment variable. Can you run your crosstool-NG build with this variable unset? I also suspect that you'd need to unset it to be able to use the built cross-compiler.

@M2shad0w
Copy link
Author

M2shad0w commented Feb 4, 2016

@jcmvbkbc thanks .
i have ever set the $CPATH in my ~/.zshrc file, it's the reason.
Now, follow your ideas, it's OK!

@M2shad0w M2shad0w closed this as completed Feb 4, 2016
@bhundven
Copy link
Contributor

bhundven commented Feb 4, 2016

@jcmvbkbc +1 Thanks for your help with this!

@bhundven bhundven reopened this Feb 4, 2016
@bhundven
Copy link
Contributor

bhundven commented Feb 4, 2016

I'm actually going to make this a test or abort in crosstool-NG.sh.in, as setting CPATH for any build could potentially break the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants