4

While running a configure script I get this warning msg:

configure: WARNING: dbus/dbus.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: dbus/dbus.h: proceeding with the compiler's result

Why would the preprocessor not accept a header accepted by the compiler?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
A1A2A3A4
  • 413
  • 1
  • 5
  • 11
  • Maybe the `cpp` (preprocessor) doesn't accept C++/C99 `//...` comments but the header contains them and the compiler does accept them (because the `cpp` being used is not the one used by or built into the compiler)? Have a look near the top of the configure output where the compiler is being sorted out. It will often list `gcc -E` as a way to get preprocessor output. – Jonathan Leffler Feb 07 '14 at 23:32
  • I'm not sure because the project contains only C code. – A1A2A3A4 Feb 07 '14 at 23:34
  • Try `grep // dbus/dbus.h` (probably with an appropriate path such as `/usr/include` or `/usr/local/include` in front of the `dbus/dbus.h`. Basically, see whether there are any C99 comments in the header file. – Jonathan Leffler Feb 07 '14 at 23:35
  • I see no C99 comments in the header file. – A1A2A3A4 Feb 07 '14 at 23:43
  • OK; that was a first guess. I'm not sure what a second guess is going to be. The message is not one I've seen before. Could there be a DOS vs Unix line-endings problem (could the header have CRLF endings and macros that are continued)? That would normally upset both preprocessor and compiler - in fact, the discrepancy is puzzling. Have you got the information from the top of the configure operation where it is determining the compiler, etc? If not, can you find it? Are you cross-compiling? What platform are you compiling on? Which compiler are you using? – Jonathan Leffler Feb 07 '14 at 23:46
  • The package was intended for a Linux system and I am compiling on Ubuntu13.10. The configure script determines gcc as the compiler. – A1A2A3A4 Feb 07 '14 at 23:55
  • That's helpful information (often worth mentioning platforms). I'm not sure what's next. Have you looked at the config.log file? Have you looked at the source of `dbus.h` to see whether there are any defines that have to be defined before it is valid? Have you tried creating a trivial file `echo "#include " > x.c` and then running `gcc -E x.c` to see what the compiler's seeing? Did you notice what the configure script said (if anything) about a preprocessor? Does the README or INSTALL file say anything useful? – Jonathan Leffler Feb 08 '14 at 00:04
  • 1
    It’s likely that this is a bug in your `configure.ac` autoconf script in how it checks for the presence and usability of `dbus/dbus.h`. Typically this happens when using [`AC_CHECK_HEADERS`](https://www.gnu.org/software/autoconf/manual/autoconf-2.61/html_node/Generic-Headers.html) but only providing the first argument to it, and not the fourth. See the [documentation](https://www.gnu.org/software/autoconf/manual/autoconf-2.61/html_node/Generic-Headers.html) for an example. Without output from `config.log` it’s impossible to be sure, though. – Philip Withnall Feb 27 '17 at 13:47

0 Answers0