Subject: pkg/37163: database/openldap-server fails on Linux with gcc-2.9.5 (pkgsrc-2007Q3)
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 10/20/2007 20:40:01
>Number:         37163
>Category:       pkg
>Synopsis:       database/openldap-server fails on Linux with gcc-2.9.5 (pkgsrc-2007Q3)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 20 20:40:01 +0000 2007
>Originator:     Ulrich Habel
>Release:        Linux 2.6 (Debian Etch)
Linux 2.6.18-5-686-bigmem #1 SMP Wed Sep 26 19:03:46 UTC 2007 i686 GNU/Linux
When I am trying to compile openldap-server on the Linux box with gcc-2.95 (it causes less breakage than the gcc-4.1.1 that ships with Debian) it fails with the following error message:

gcc -O2 -I/usr/pkg/include/db4 -I/usr/pkg/include -I/usr/include  -I../../include -I. -I./slapi -I. -I../../include   -I/usr/pkg/include/db4 -I/usr/pkg/include -I/usr/include  -I/usr/pkg/include/db4 -I/usr/pkg/include -I/usr/include -c backglue.c
backglue.c: In function `glue_entry_get_rw':
backglue.c:624: parse error before `int'
backglue.c:627: `rc' undeclared (first use in this function)
backglue.c:627: (Each undeclared identifier is reported only once
backglue.c:627: for each function it appears in.)
*** Error code 1

bmake: stopped in /usr/pkgsrc/databases/openldap-server/work/openldap-2.3.38/servers/slapd
*** Error code 1
just try to build it.
There has been already a discussion about this on the openldap mailing list:
(the patch form the ML is wrong)

I looked into it and found a small patch:

--- servers/slapd/backglue.c.orig       2007-10-20 20:15:37.000000000 +0200
+++ servers/slapd/backglue.c    2007-10-20 20:18:09.000000000 +0200
@@ -620,8 +620,9 @@
        Entry   **e )
        BackendDB *b0 = op->o_bd;
-       op->o_bd = glue_back_select( b0, dn );
        int rc;
+       op->o_bd = glue_back_select( b0, dn );

        if ( op->o_bd->be_fetch ) {
                rc = op->o_bd->be_fetch( op, dn, oc, ad, rw, e );