Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 135868 - zabbix-server-1.1 using postgres doesn't compile w/ USE="postgresql"
Summary: zabbix-server-1.1 using postgres doesn't compile w/ USE="postgresql"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Other
: High normal (vote)
Assignee: Wolfram Schlich (RETIRED)
URL: http://www.zabbix.com
Whiteboard:
Keywords:
: 135876 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-07 00:45 UTC by Eckard Brauer
Modified: 2007-09-23 00:12 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eckard Brauer 2006-06-07 00:45:52 UTC
trying to compile zabbix-server-1.1 with USE="+ldap -mysql -oracle* +postgres +snmp" leads to the following result:

----- snip! -----
if i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include  -I/usr/include/postgresql     -march=pentium4 -O3 -pipe -fomit-frame-pointer -MT action.o -MD -MP -MF ".deps/action.Tpo" -c -o action.o action.c; \
then mv -f ".deps/action.Tpo" ".deps/action.Po"; else rm -f ".deps/action.Tpo"; exit 1; fi
In file included from action.c:27:
../../../include/db.h:316: error: syntax error before '*' token
../../../include/db.h:316: warning: data definition has no type or storage class
../../../include/db.h:317: error: syntax error before '*' token
../../../include/db.h:317: warning: data definition has no type or storage class
../../../include/db.h:318: error: syntax error before "DBfetch"
../../../include/db.h:318: error: syntax error before '*' token
../../../include/db.h:318: warning: data definition has no type or storage class
../../../include/db.h:349: error: syntax error before "DB_ROW"
action.c: In function `DBget_action_by_actionid':
action.c:65: error: `PGresult' undeclared (first use in this function)
action.c:65: error: (Each undeclared identifier is reported only once
action.c:65: error: for each function it appears in.)
action.c:65: error: `result' undeclared (first use in this function)
action.c:66: error: `DB_ROW' undeclared (first use in this function)
action.c:66: error: syntax error before "row"
action.c:74: error: `row' undeclared (first use in this function)
----- snap! -----

a look into include/db.h shows this:

----- snip! -----
#ifdef HAVE_MYSQL
        #include "mysql.h"
        #include "errmsg.h"
        #include "mysqld_error.h"
#define DB_HANDLE       MYSQL
#endif

#ifdef HAVE_ORACLE
        #include "sqlora.h"
#endif
...
#ifdef HAVE_MYSQL
        #define DB_RESULT       MYSQL_RES *
        #define DBfree_result   mysql_free_result
        #define DB_ROW          MYSQL_ROW
#endif

#ifdef HAVE_PGSQL
        #define DB_RESULT       PGresult *
        #define DBfree_result   PQclear
#endif

#ifdef HAVE_ORACLE
        #define DB_RESULT       sqlo_stmt_handle_t
        #define DBfree_result   sqlo_close
        #define DB_ROW          char **
#endif
----- snip! -----

for me, this means that there's some Postgres related code from 1.0, but for general, Postgres isn't really supported in 1.1, as the web pages seem to tell.

The ebuild should reflect this, and reward the postgres USE flag with an error message until Postgres is supported again.
Comment 1 Wolfram Schlich (RETIRED) gentoo-dev 2006-06-07 02:23:29 UTC
Will look into it.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-06-07 02:32:02 UTC
*** Bug 135876 has been marked as a duplicate of this bug. ***
Comment 3 Eckard Brauer 2006-06-07 02:37:30 UTC
Currently trying out the following patch (making zabbix-server compile w/o problems, just checking if it works):

diff -ur zabbix-1.1.orig/configure.in zabbix-1.1/configure.in
--- zabbix-1.1.orig/configure.in        2006-05-31 08:32:36.000000000 +0200
+++ zabbix-1.1/configure.in     2006-06-07 10:44:57.000000000 +0200
@@ -656,7 +656,7 @@
        dnl To avoid linking of crypt with the agent
        dnl    AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, LIBS="-lcrypt $LIBS"))
        dnl    AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt,  PGSQL_LFLAGS="-lcrypt $PGSQL_LFLAGS"))
-           AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt,  PGSQL_LIBS="-lcrypt"))
+           AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt,  PGSQL_LIBS="$PGSQL_LIBS -lcrypt"))

            AC_DEFINE(HAVE_PGSQL,1,[Define to 1 if PostgreSQL should be enabled.])
            AC_MSG_RESULT(yes)
diff -ur zabbix-1.1.orig/include/db.h zabbix-1.1/include/db.h
--- zabbix-1.1.orig/include/db.h        2006-05-26 14:13:17.000000000 +0200
+++ zabbix-1.1/include/db.h     2006-06-07 10:13:50.000000000 +0200
@@ -34,6 +34,10 @@
 #define        DB_HANDLE       MYSQL
 #endif

+#ifdef HAVE_PGSQL
+       #include "libpq-fe.h"
+#endif
+
 #ifdef HAVE_ORACLE
        #include "sqlora.h"
 #endif
@@ -70,6 +74,7 @@
 #ifdef HAVE_PGSQL
        #define DB_RESULT       PGresult *
        #define DBfree_result   PQclear
+       #define DB_ROW          char **
 #endif

 #ifdef HAVE_ORACLE
diff -ur zabbix-1.1.orig/src/libs/zbxdbhigh/db.c zabbix-1.1/src/libs/zbxdbhigh/db.c
--- zabbix-1.1.orig/src/libs/zbxdbhigh/db.c     2006-06-02 14:36:06.000000000 +0200
+++ zabbix-1.1/src/libs/zbxdbhigh/db.c  2006-06-07 10:21:12.000000000 +0200
@@ -142,7 +142,7 @@
 #ifdef HAVE_PGSQL
        PGresult        *result;

-       aabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s",query);
+       zabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s",query);
        result = PQexec(conn,query);

        if( result==NULL)
@@ -325,7 +325,7 @@
        return mysql_insert_id(&mysql);
 #endif
 #ifdef HAVE_PGSQL
-#error SUPPORT OF POSTGRESQL NOT IMPLEMENTED YET
+       return FAIL;
 #endif
 #ifdef HAVE_ORACLE
        return FAIL;
Comment 4 Wolfram Schlich (RETIRED) gentoo-dev 2006-06-07 03:17:05 UTC
Fixed. Please wait a couple of hours, then resync and retry merging.

The Zabbix website is really unclear about PostgreSQL support:
http://www.zabbix.com/download.php says "MySQL or Oracle" for 1.1
http://www.zabbix.com/manual/v1.1/install.php says "PostgreSQL (or MySQL)" and "MySQL or PostgreSQL development files (headers and libraries)."

That leaves kind of a bad taste :-(
Comment 5 Wolfram Schlich (RETIRED) gentoo-dev 2006-06-07 03:18:45 UTC
Well, I won't patch in something that upstream decided not to implement for whatever reason.
Please subscribe to the Zabbix-Developers mailing list and post your patch there to get it into upstream.

Thanks!