Issue 7074 - back-ldap module compilation issue with gcc 4.6.1
Summary: back-ldap module compilation issue with gcc 4.6.1
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.26
Hardware: All All
: --- normal
Target Milestone: 2.4.50
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-29 13:52 UTC by stephane.paquot@gmail.com
Modified: 2020-04-28 16:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description stephane.paquot@gmail.com 2011-10-29 13:52:13 UTC
Full_Name: St�phane PAQUOT
Version: 2.4.26
OS: Windows (MingW)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (83.194.186.14)


Hi

I am actually compiling backend modules for openldap 2.4.26 with MingW (gcc
version 4.6.1, GNU make 3.81, GNU libtool 2.4, GNU automake 1.11.1, GNU autoconf
2.68.
An issue occurs when compiling back-ldap module.

The GNU tools used are the following :
        host-triplet:   i686-pc-mingw32
        shell:          /bin/sh
        compiler:               gcc
        compiler flags:         -O3 -s -mms-bitfields -march=i386 -mtune=i686
        linker:         c:/mingw/mingw32/bin/ld.exe (gnu? yes)
        libtool:        (GNU libtool) 2.4
        automake:       automake (GNU automake) 1.11.1
        autoconf:       autoconf (GNU Autoconf) 2.68

The command line to compile openldap 2.4.26 is the following

./configure --prefix=/software/openldap \
        --enable-slapd \
        --enable-modules \
        --enable-rewrite \
        --enable-bdb=mod \
        --enable-hdb=mod \
        --enable-ldap=mod \
        --enable-sql=mod \
	--enable-monitor=mod \
        --enable-accesslog=mod \
        --enable-auditlog=mod \
        --enable-rwm=mod \
	--enable-syncprov=mod \
        --with-odbc=odbc32 \
        --with-tls=openssl \
        --without-cyrus-sasl

Here are the compilation flags :
CPPFLAGS="-I/software/openssl/include
-I/software/berkeleydb/berkeleydb-5.2/include"
LDFLAGS="-I/software/openssl/lib -I/software/berkeleydb/berkeleydb-5.2/lib"
LIBS="-lodbc32 -lws2_32"

All backends modules and overlays compile fine but when compiling backend
back-ldap as a module, the following compile error occurs : error: initializer
element is not constant.

$ make
/bin/sh ../../../libtool --tag=disable-static --mode=compile gcc -g -O2
-std=c89
 -I../../../include        -I../../../include -I.. -I./.. 
-I/software/openssl/i
nclude -I/software/berkeleydb/berkeleydb-5.2/include   -DSLAPD_IMPORT -c
chain.c

 gcc -g -O2 -std=c89 -I../../../include -I../../../include -I.. -I./..
-I/softwa
re/openssl/include -I/software/berkeleydb/berkeleydb-5.2/include -DSLAPD_IMPORT
-c chain.c  -DDLL_EXPORT -DPIC -o .libs/chain.o
chain.c:1273:3: error: initializer element is not constant
chain.c:1273:3: error: (near initialization for 'chainocs[1].co_table')
make: *** [chain.lo] Error 1

gcc 4.6.1 complains about 

static ConfigOCs chainocs[] = {
        { "( OLcfgOvOc:3.1 "
                "NAME 'olcChainConfig' "
                "DESC 'Chain configuration' "
                "SUP olcOverlayConfig "
                "MAY ( "
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
                        "olcChainingBehavior $ "
#endif  /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
                        "olcChainCacheURI $ "
                        "olcChainMaxReferralDepth $ "
                        "olcChainReturnError "
                        ") )",
                Cft_Overlay, chaincfg, NULL, chain_cfadd },
        { "( OLcfgOvOc:3.2 "
                "NAME 'olcChainDatabase' "
                "DESC 'Chain remote server configuration' "
                "AUXILIARY )",
                Cft_Misc, olcDatabaseDummy, chain_ldadd
#ifdef SLAP_CONFIG_DELETE
                , NULL, chain_lddel
#endif
        },
        { NULL, 0, NULL}
};

I try to solve this problem but I'm a little stuck. When back-ldap is not
compiled as a module, no problem, slapd compiles fine with this backend
back-ldap.


Best regards and many thanks to you.

St�phane PAQUOT
Database Administrator (Sybase, Oracle, MS SQL Server, MySQL).
France, Paris.



Comment 1 Howard Chu 2011-11-01 18:49:46 UTC
stephane.paquot@gmail.com wrote:
> Full_Name: Stéphane PAQUOT
> Version: 2.4.26
> OS: Windows (MingW)
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (83.194.186.14)
>
>
> Hi
>
> I am actually compiling backend modules for openldap 2.4.26 with MingW (gcc
> version 4.6.1, GNU make 3.81, GNU libtool 2.4, GNU automake 1.11.1, GNU autoconf
> 2.68.
> An issue occurs when compiling back-ldap module.
>
> The GNU tools used are the following :
>          host-triplet:   i686-pc-mingw32
>          shell:          /bin/sh
>          compiler:               gcc
>          compiler flags:         -O3 -s -mms-bitfields -march=i386 -mtune=i686
>          linker:         c:/mingw/mingw32/bin/ld.exe (gnu? yes)
>          libtool:        (GNU libtool) 2.4
>          automake:       automake (GNU automake) 1.11.1
>          autoconf:       autoconf (GNU Autoconf) 2.68
>
> The command line to compile openldap 2.4.26 is the following
>
> ./configure --prefix=/software/openldap \
>          --enable-slapd \
>          --enable-modules \
>          --enable-rewrite \
>          --enable-bdb=mod \
>          --enable-hdb=mod \
>          --enable-ldap=mod \
>          --enable-sql=mod \
> 	--enable-monitor=mod \
>          --enable-accesslog=mod \
>          --enable-auditlog=mod \
>          --enable-rwm=mod \
> 	--enable-syncprov=mod \
>          --with-odbc=odbc32 \
>          --with-tls=openssl \
>          --without-cyrus-sasl
>
> Here are the compilation flags :
> CPPFLAGS="-I/software/openssl/include
> -I/software/berkeleydb/berkeleydb-5.2/include"
> LDFLAGS="-I/software/openssl/lib -I/software/berkeleydb/berkeleydb-5.2/lib"
> LIBS="-lodbc32 -lws2_32"
>
> All backends modules and overlays compile fine but when compiling backend
> back-ldap as a module, the following compile error occurs : error: initializer
> element is not constant.
>
> $ make
> /bin/sh ../../../libtool --tag=disable-static --mode=compile gcc -g -O2
> -std=c89
>   -I../../../include        -I../../../include -I.. -I./..
> -I/software/openssl/i
> nclude -I/software/berkeleydb/berkeleydb-5.2/include   -DSLAPD_IMPORT -c
> chain.c
>
>   gcc -g -O2 -std=c89 -I../../../include -I../../../include -I.. -I./..
> -I/softwa
> re/openssl/include -I/software/berkeleydb/berkeleydb-5.2/include -DSLAPD_IMPORT
> -c chain.c  -DDLL_EXPORT -DPIC -o .libs/chain.o
> chain.c:1273:3: error: initializer element is not constant
> chain.c:1273:3: error: (near initialization for 'chainocs[1].co_table')
> make: *** [chain.lo] Error 1
>
> gcc 4.6.1 complains about
>
> static ConfigOCs chainocs[] = {
>          { "( OLcfgOvOc:3.1 "
>                  "NAME 'olcChainConfig' "
>                  "DESC 'Chain configuration' "
>                  "SUP olcOverlayConfig "
>                  "MAY ( "
> #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
>                          "olcChainingBehavior $ "
> #endif  /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
>                          "olcChainCacheURI $ "
>                          "olcChainMaxReferralDepth $ "
>                          "olcChainReturnError "
>                          ") )",
>                  Cft_Overlay, chaincfg, NULL, chain_cfadd },
>          { "( OLcfgOvOc:3.2 "
>                  "NAME 'olcChainDatabase' "
>                  "DESC 'Chain remote server configuration' "
>                  "AUXILIARY )",
>                  Cft_Misc, olcDatabaseDummy, chain_ldadd
> #ifdef SLAP_CONFIG_DELETE
>                  , NULL, chain_lddel
> #endif
>          },
>          { NULL, 0, NULL}
> };
>
> I try to solve this problem but I'm a little stuck. When back-ldap is not
> compiled as a module, no problem, slapd compiles fine with this backend
> back-ldap.

This type of problem seems to crop up regularly with Windows modules; the 
Windows linker is too stupid to figure out how to reference a data symbol from 
a different binary.

In this case you can fix it by making a local copy of the definition of 
olcDatabaseDummy (which is in slapd/bconfig.c) and use the local copy in this 
table instead of the original.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 2 Howard Chu 2011-11-08 00:44:17 UTC
changed state Open to Feedback
Comment 3 stephane.paquot@gmail.com 2011-11-09 14:16:22 UTC
Hi Howard,

Compilation is fine and module back-ldap is fully operational with the
workaround you have suggested.

Many thanks to you.


2011/10/29 <openldap-its@openldap.org>

>
> *** THIS IS AN AUTOMATICALLY GENERATED REPLY ***
>
> Thanks for your report to the OpenLDAP Issue Tracking System.  Your
> report has been assigned the tracking number ITS#7074.
>
> One of our support engineers will look at your report in due course.
> Note that this may take some time because our support engineers
> are volunteers.  They only work on OpenLDAP when they have spare
> time.
>
> If you need to provide additional information in regards to your
> issue report, you may do so by replying to this message.  Note that
> any mail sent to openldap-its@openldap.org with (ITS#7074)
> in the subject will automatically be attached to the issue report.
>
>        mailto:openldap-its@openldap.org?subject=(ITS#7074)
>
> You may follow the progress of this report by loading the following
> URL in a web browser:
>    http://www.OpenLDAP.org/its/index.cgi?findid=7074
>
> Please remember to retain your issue tracking number (ITS#7074)
> on any further messages you send to us regarding this report.  If
> you don't then you'll just waste our time and yours because we
> won't be able to properly track the report.
>
> Please note that the Issue Tracking System is not intended to
> be used to seek help in the proper use of OpenLDAP Software.
> Such requests will be closed.
>
> OpenLDAP Software is user supported.
>        http://www.OpenLDAP.org/support/
>
> --------------
> Copyright 1998-2007 The OpenLDAP Foundation, All Rights Reserved.
>
>


-- 
_________________________________

Stéphane PAQUOT

stephane.paquot@gmail.com
Site web : http://www.sqlpac.com/
Comment 4 Hallvard Furuseth 2011-11-25 10:16:20 UTC
changed state Feedback to Open
Comment 5 Quanah Gibson-Mount 2017-03-29 22:18:55 UTC
moved from Incoming to Software Bugs
Comment 6 Quanah Gibson-Mount 2020-03-20 05:38:33 UTC
hyc - Is there really anything for us to do here for this bug report?  Seems to be a Windows issue we have no control over.
Comment 7 Quanah Gibson-Mount 2020-03-20 19:09:29 UTC
Commits: 
  • f4bfb5e0 
by Emily Backes at 2020-03-20T19:08:22+00:00 
ITS#7074 - change olcDatabaseDummy initialization for windows
Comment 8 Quanah Gibson-Mount 2020-04-02 21:32:54 UTC
Commits: 
  • 9b8cd201 
by Emily Backes at 2020-04-02T20:43:03+00:00 
ITS#7074 - change olcDatabaseDummy initialization for windows