[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7074) back-ldap module compilation issue with gcc 4.6.1



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/