nagios expects libpq-fe.h but could not find it Reproducible: Always Steps to Reproduce: 1. emerge nagios-core 2. 3. Actual Results: gcc -O2 -march=i386 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl5/5.8.2/i486-linux/CORE -DHAVE_CONFIG_H -DNSCORE -lpq nagios.c checks.o config.o commands.o flapping.o logging.o notifications.o sehandlers.o utils.o sretention.o ../xdata/xrddb.c ../common/comments.c ../xdata/xcddb.c ../common/objects.c ../xdata/xodtemplate.c ../common/statusdata.c ../xdata/xsddb.c perfdata.o ../xdata/xpddefault.c ../common/downtime.c ../xdata/xdddb.c -rdynamic -L/usr/local/lib /usr/lib/perl5/5.8.2/i486-linux/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.8.2/i486-linux/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lm -o nagios ../xdata/xrddb.c:46:28: pgsql/libpq-fe.h: No such file or directory ../xdata/xrddb.c:63: error: syntax error before '*' token ../xdata/xrddb.c:63: warning: data definition has no type or storage class ../xdata/xrddb.c:64: error: syntax error before '*' token ../xdata/xrddb.c:64: warning: data definition has no type or storage class ../xdata/xrddb.c: In function `xrddb_connect': ../xdata/xrddb.c:268: warning: assignment makes pointer from integer without a cast ../xdata/xrddb.c:270: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xrddb.c:270: error: (Each undeclared identifier is reported only once ../xdata/xrddb.c:270: error: for each function it appears in.) ../xdata/xrddb.c: In function `xrddb_disconnect': ../xdata/xrddb.c:304: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xrddb.c: In function `xrddb_query': ../xdata/xrddb.c:334: warning: assignment makes pointer from integer without a cast ../xdata/xrddb.c:335: error: `PGRES_FATAL_ERROR' undeclared (first use in this function) ../xdata/xrddb.c:335: error: `PGRES_BAD_RESPONSE' undeclared (first use in this function) ../xdata/xrddb.c: In function `xrddb_read_program_information': ../xdata/xrddb.c:876: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:877: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:878: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:879: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:880: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:881: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:882: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:883: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c: In function `xrddb_read_host_information': ../xdata/xrddb.c:1016: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1019: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1022: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1025: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1026: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1027: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1030: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1033: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1036: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1039: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1042: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1045: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1048: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1051: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1054: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1057: warning: passing arg 1 of `set_host_state_information' makes pointer from integer without a cast ../xdata/xrddb.c:1057: warning: passing arg 3 of `set_host_state_information' makes pointer from integer without a cast ../xdata/xrddb.c: In function `xrddb_read_service_information': ../xdata/xrddb.c:1207: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1214: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1217: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1220: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1221: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1222: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1223: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1226: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1229: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1232: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1235: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1238: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1241: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1244: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1247: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1250: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1253: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1256: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xrddb.c:1259: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xrddb.c:1262: warning: passing arg 1 of `set_service_state_information' makes pointer from integer without a cast ../xdata/xrddb.c:1262: warning: passing arg 2 of `set_service_state_information' makes pointer from integer without a cast ../xdata/xrddb.c:1262: warning: passing arg 4 of `set_service_state_information' makes pointer from integer without a cast ../xdata/xcddb.c:54:28: pgsql/libpq-fe.h: No such file or directory ../xdata/xcddb.c:70: error: syntax error before '*' token ../xdata/xcddb.c:70: warning: data definition has no type or storage class ../xdata/xcddb.c:71: error: syntax error before '*' token ../xdata/xcddb.c:71: warning: data definition has no type or storage class ../xdata/xcddb.c: In function `xcddb_connect': ../xdata/xcddb.c:278: warning: assignment makes pointer from integer without a cast ../xdata/xcddb.c:280: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xcddb.c:280: error: (Each undeclared identifier is reported only once ../xdata/xcddb.c:280: error: for each function it appears in.) ../xdata/xcddb.c: In function `xcddb_disconnect': ../xdata/xcddb.c:308: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xcddb.c: In function `xcddb_query': ../xdata/xcddb.c:334: warning: assignment makes pointer from integer without a cast ../xdata/xcddb.c:335: error: `PGRES_FATAL_ERROR' undeclared (first use in this function) ../xdata/xcddb.c:335: error: `PGRES_BAD_RESPONSE' undeclared (first use in this function) ../xdata/xcddb.c: In function `xcddb_validate_host_comments': ../xdata/xcddb.c:508: warning: passing arg 1 of `find_host' makes pointer from integer without a cast ../xdata/xcddb.c:512: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xcddb.c: In function `xcddb_validate_service_comments': ../xdata/xcddb.c:597: warning: passing arg 1 of `find_service' makes pointer from integer without a cast ../xdata/xcddb.c:597: warning: passing arg 2 of `find_service' makes pointer from integer without a cast ../xdata/xcddb.c:601: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xcddb.c: In function `xcddb_save_host_comment': ../xdata/xcddb.c:761: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xcddb.c: In function `xcddb_save_service_comment': ../xdata/xcddb.c:860: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xsddb.c:51:28: pgsql/libpq-fe.h: No such file or directory ../xdata/xsddb.c:66: error: syntax error before '*' token ../xdata/xsddb.c:66: warning: data definition has no type or storage class ../xdata/xsddb.c:67: error: syntax error before '*' token ../xdata/xsddb.c:67: warning: data definition has no type or storage class ../xdata/xsddb.c: In function `xsddb_connect': ../xdata/xsddb.c:307: warning: assignment makes pointer from integer without a cast ../xdata/xsddb.c:309: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xsddb.c:309: error: (Each undeclared identifier is reported only once ../xdata/xsddb.c:309: error: for each function it appears in.) ../xdata/xsddb.c: In function `xsddb_disconnect': ../xdata/xsddb.c:340: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xsddb.c: In function `xsddb_check_connection': ../xdata/xsddb.c:378: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xsddb.c: In function `xsddb_query': ../xdata/xsddb.c:468: warning: assignment makes pointer from integer without a cast ../xdata/xsddb.c:469: error: `PGRES_FATAL_ERROR' undeclared (first use in this function) ../xdata/xsddb.c:469: error: `PGRES_BAD_RESPONSE' undeclared (first use in this function) ../xdata/xdddb.c:54:28: pgsql/libpq-fe.h: No such file or directory ../xdata/xdddb.c:70: error: syntax error before '*' token ../xdata/xdddb.c:70: warning: data definition has no type or storage class ../xdata/xdddb.c:71: error: syntax error before '*' token ../xdata/xdddb.c:71: warning: data definition has no type or storage class ../xdata/xdddb.c: In function `xdddb_connect': ../xdata/xdddb.c:278: warning: assignment makes pointer from integer without a cast ../xdata/xdddb.c:280: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xdddb.c:280: error: (Each undeclared identifier is reported only once ../xdata/xdddb.c:280: error: for each function it appears in.) ../xdata/xdddb.c: In function `xdddb_disconnect': ../xdata/xdddb.c:308: error: `CONNECTION_BAD' undeclared (first use in this function) ../xdata/xdddb.c: In function `xdddb_query': ../xdata/xdddb.c:334: warning: assignment makes pointer from integer without a cast ../xdata/xdddb.c:335: error: `PGRES_FATAL_ERROR' undeclared (first use in this function) ../xdata/xdddb.c:335: error: `PGRES_BAD_RESPONSE' undeclared (first use in this function) ../xdata/xdddb.c: In function `xdddb_validate_host_downtime': ../xdata/xdddb.c:513: warning: passing arg 1 of `find_host' makes pointer from integer without a cast ../xdata/xdddb.c:517: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c:522: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:526: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c: In function `xdddb_validate_service_downtime': ../xdata/xdddb.c:627: warning: passing arg 1 of `find_service' makes pointer from integer without a cast ../xdata/xdddb.c:627: warning: passing arg 2 of `find_service' makes pointer from integer without a cast ../xdata/xdddb.c:631: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c:636: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:640: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c: In function `xdddb_save_host_downtime': ../xdata/xdddb.c:801: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c: In function `xdddb_save_service_downtime': ../xdata/xdddb.c:900: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c: In function `xdddb_read_host_downtime': ../xdata/xdddb.c:1161: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c:1164: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1167: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1170: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1173: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c:1176: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1179: warning: passing arg 1 of `add_host_downtime' makes pointer from integer without a cast ../xdata/xdddb.c:1179: warning: passing arg 3 of `add_host_downtime' makes pointer from integer without a cast ../xdata/xdddb.c:1179: warning: passing arg 4 of `add_host_downtime' makes pointer from integer without a cast ../xdata/xdddb.c: In function `xdddb_read_service_downtime': ../xdata/xdddb.c:1292: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c:1295: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1298: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1301: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1304: warning: passing arg 1 of `atoi' makes pointer from integer without a cast ../xdata/xdddb.c:1307: warning: passing arg 1 of `strtoul' makes pointer from integer without a cast ../xdata/xdddb.c:1310: warning: passing arg 1 of `add_service_downtime' makes pointer from integer without a cast ../xdata/xdddb.c:1310: warning: passing arg 2 of `add_service_downtime' makes pointer from integer without a cast ../xdata/xdddb.c:1310: warning: passing arg 4 of `add_service_downtime' makes pointer from integer without a cast ../xdata/xdddb.c:1310: warning: passing arg 5 of `add_service_downtime' makes pointer from integer without a cast make[1]: *** [nagios] Error 1 make[1]: Leaving directory `/var/tmp/portage/nagios-core-1.1-r4/work/nagios-1.1/base' make: *** [all] Error 2 !!! ERROR: net-analyzer/nagios-core-1.1-r4 failed. !!! Function src_compile, Line 73, Exitcode 2 !!! make failed Expected Results: compile fine. Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.6.4-mm2) ================================================================= System uname: 2.6.4-mm2 i686 Intel(R) Pentium(R) 4 CPU 2.60GHz Gentoo Base System version 1.4.3.13 Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.7.7 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O2 -march=i386" CHOST="i486-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /etc/tomcat /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=i386" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X aalib alsa apache apache2 apm arts avi berkdb bonobo cdr clamav crypt cups curl dga dvd dvdr encode esd foomaticdb gd gdbm gif gnome gphoto gphoto2 gpm gstreams gtk gtk2 gtkhtml imap imlib jack java jikes jpeg kde lcms ldap libg++ libwww mad mikmod motif mozilla mpeg ncurses nls oggvorbis opengl oss pam pda pdflib perl plotutils png postgres python qt quicktime readline ruby samba sasl scanner sdl slang smpgsql snmp spell sse ssl svga tcltk tcpd tetex tiff truetype unicode usb virus-scan wmf x86 xinerama xml xml2 xml2xmms xmms xv zlib"
What version of postgresql do you have installed?
The installed PostgreSQL version is: PostgreSQL 7.3.6 on i486-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)
What I was asking was what portage version postgresql?
My installed postgres version is: * dev-db/postgresql Latest version available: 7.3.6 Latest version installed: 7.3.6 Size of downloaded files: 8,130 kB Homepage: http://www.postgresql.org/ Description: sophisticated Object-Relational DBMS License: POSTGRESQL Sorry for misunderstanding!
I found a solution that appears to work, using sys-apps/portage-2.0.50-r5 dev-db/postgresql-7.3.6 net-analyzer/nagios-core-1.2 1) Edit the nagios-core-1.2.ebuild 2) Change the postgres section as follows (bottommost line is the change): use postgres && myconf="${myconf} \ --with-pgsql-xdata \ --with-pgsql-status \ --with-pgsql-comments \ --with-pgsql-extinfo \ --with-pgsql-retention \ --with-pgsql-downtime \ --with-pgsql-inc=/usr/include/postgresql" This may not be the best way to go about fixing this problem, but it does compile without errors. I had run into the exact same problem trying to emerge nagios-core-1.1-r4, and may apply to it as well.
Thanks for suggestion, it works for me and the 1.1-r4, but this is a crude hack for the elegant emerge system
yes, after experiencing the same problem, I investigated and it is clear that the issue is that nagios isn't adding -I/usr/include/postgresql to the compiler flags.
Well, the nagios configure script doesn't even try to locate the include dir. for mysql, this is no problem because the .h files are under /usr/include/mysql and are included as <mysql/someheader.h>. pgsql headers are included as <pgsql/someheader.h> but it is /usr/include/postgresql/pgsql/someheader.h... It is inevitable to add --with-pgsql-inc=/usr/include/postgresql (but only if the pgsql headers are located like this) also, I hard coded it because pg_config doesn't behave like it should (bug 56091).
in portage (nagios-core-1.2-r1).
"../xdata/xrddb.c:46:28: pgsql/libpq-fe.h: No such file or directory" AFAIK (after digging into the postgresql mailing list archives) this is wrong, they sould include the libpq-fe.h in the directory reported from the output of "pg_config --includedir" (yes, there are to identical libpq-fe.h below /usr/include; the same applies to postgres_ext.h, but this is found three times below /usr/include).
Thomas, do you still get compile errors because of this, or is this issue solved with the latest ebuild? btw, it wouldn't matter what pg_config would report, because nagios' configure script doesn't consult it. I would ask for nagios' developers to include a check for it, but first I need pg_config to be honest.
This issue is solved with the last ebuild, thanx a lot to all! It compiles fine. But i think to solve the problem "smooth" the nagios team should change the include from #include <pgsql/libpq-fe.h> to #include <libpq-fe.h> and adding -I[output from pg_config --includedir] to the compiler flags.
I agree. But as I said in an earlier comment, this relies on bug 56091 to be solved first.