Re: Mozilla ldap c-sdk 6.0.6 build/compilation issue using cygwin

Rich Megginson <[email protected]> Fri, 16 Oct 2009 13:15:12 -0600
Newsgroups gmane.comp.mozilla.devel.directory
Message-ID <[email protected]>
ashwani saxena wrote:
> Hi All,
> 
> I am trying to build Mozilla ldap c-SDK (Version 6.0.6) using cygwin
> (ONLY) in Windows XP environment and having issues while building c-
> SDK.
> 
> I will illustrate what all I did.
> 
> 1. Added the following 3 parameters in "mozilla\security\coreconf
> \Win32.mk" file.
>    Entries:
>    DEFAULT_COMPILER = gcc
>    NS_USE_GCC=1
>    NO_MDUPDATE=1
> This entry was required to set the default compiler to 'gcc'.
> 
> 2. Build NSS with NSPR (NSS-3.12-WITH-NSPR-4.7)by issuing the
> following command.
>     $mozilla\security\nss: make nss_build_all
>     Result: It failed, complaining that below listed modules cant be
> built.
>     - mozilla\security\nss\cmd\bltest
>     - mozilla\security\nss\cmd\certcgi
>     - mozilla\security\nss\cmd\fipstest
>     - mozilla\security\nss\cmd\ocspclnt
>     - mozilla\security\nss\cmd\rsaperf
>     - mozilla\security\nss\cmd\signtool
>     - mozilla\security\nss\cmd\signver
> 
>     ERROR: Each module failed to build coz of following error:
> "mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.c:398: undefined
> reference to `_PKIX_ResourceLimits_GetMaxFanout'"
> 
> 3. Not sure whether i really need those commands (above stated) to be
> built, I continued and tried to build c-SDK (I have Directory -
> mozldap-6.0.6 Version)
> 
> 4. Issued the configure command from "mozilla\directory\c-sdk"
>    $mozilla\directory\c-sdk> ./configure --with-nss [NS_USE_GCC=1]
> 
>    NOTE: I explicitly issued with "NS_USE_GCC=1" so that gcc
> compiler can be considered. If i dont provide this option then it will
> by default look for "cl" thats not configured therefore throwing error
> (can not create executables........)
> 
> 5. Navigated to "mozilla\directory\c-sdk\ldap\include" and issued make
> command it. It went fine and copied all the required .h files into
> dist folder.
> 
> 6. Navigated to ""mozilla\directory\c-sdk\ldap" and issued the make
> command but it failed.
> The error logs are as mentioned:
> 
> asaxena@XYZ/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/6.0.6/mozilla/
> directory/c-sdk/ldap
> $ make
> cd include; make BUILD_DEBUG=full export
> make[1]: Entering directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/include'
> /usr/bin/nsinstall -D ../../../../dist/public/ldap
> /usr/bin/nsinstall -D ../../../../dist/public/ldap-private
> /usr/bin/nsinstall -R  -m 644 ./disptmpl.h ./lber.h ./ldap.h ./ldap-
> extension.h
> ./ldap-platform.h ./ldap-to-be-deprecated.h ./ldap-deprecated.h  ./
> ldap_ssl.h ./ldappr.h ./ldif.h ./iutil.h ./srchpref.h ../../../../dist/
> public/ldap
> /usr/bin/nsinstall -R  -m 644 ./../libraries/libldap/ldap-int.h ./../
> libraries/liblber/lber-int.h ./portable.h ./ldaprot.h ./
> ldaplog.h ../../../../dist/public/ldap-private
> make[1]: Leaving directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/include'
> cd libraries; make BUILD_DEBUG=full export
> make[1]: Entering directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries'
> cd liblber; make BUILD_DEBUG=full export
> make[2]: Entering directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/liblber'
> /usr/bin/nsinstall -R -m 444 ./libnslber32v60.a ../../../../../dist/
> lib
> make[2]: Leaving directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/liblber'
> cd libldif; make BUILD_DEBUG=full export
> make[2]: Entering directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/libldif'
> /usr/bin/nsinstall -R -m 444 ./libnsldif32v60.a ../../../../../dist/
> lib
> /usr/bin/nsinstall -R -m 444 ./libnsldif32v60.a ../../../../../dist/
> lib
> /usr/bin/nsinstall -R -m 444 ./libnsldif32v60.so ../../../../../dist/
> lib
> /usr/bin/nsinstall -R -m 444 ./libnsldif32v60.so ../../../../../dist/
> bin
> make[2]: Leaving directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/libldif'
> cd libiutil; make BUILD_DEBUG=full export
> make[2]: Entering directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/libiutil'
> /usr/bin/nsinstall -R -m 444 ./libnsiutil32v60.a ../../../../../dist/
> lib
> make[2]: Leaving directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/libiutil'
> cd libldap; make BUILD_DEBUG=full export
> make[2]: Entering directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/libldap'
> ======= making ./libnsldap32v60.so
> gcc -shared -Wl,--export-all-symbols -Wl,--out-implib -
> Wl,libnsldap32v60.a   -o libnsldap32v60.so ./abandon.o ./add.o ./
> authzidctrl.o ./bind.o ./cache.o ./charray.o ./charset.o ./compare.o ./
> compat.o ./control.o ./countvalues.o ./delete.o ./disptmpl.o ./
> dsparse.o ./error.o ./extendop.o ./free.o ./freevalues.o ./
> friendly.o ./getattr.o ./getdn.o ./getdxbyname.o ./
> geteffectiverightsctrl.o ./getentry.o ./getfilter.o ./getoption.o ./
> getvalues.o ./memcache.o ./message.o ./modify.o./open.o ./os-ip.o ./
> proxyauthctrl.o ./psearch.o ./pwmodext.o ./pwpctrl.o ./referral.o ./
> regex.o ./rename.o ./request.o ./reslist.o ./result.o ./saslbind.o ./
> sbind.o ./search.o ./setoption.o ./sort.o ./sortctrl.o ./srchpref.o ./
> tmplout.o ./ufn.o ./unbind.o ./unescape.o ./url.o ./userstatusctrl.o ./
> utf8.o ./vlistctrl.o./whoami.o ./dllmain.o ./mozock.o   -
> L../../../../../dist/lib -lnslber32v60./os-ip.o: In function
> `nsldapi_try_each_host':
> /cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/6.0.6/mozilla/directory/c-sdk/
> ldap/libraries/libldap/os-ip.c:595: undefined reference to
> `_gethostbyname_r'
> Creating library file: libnsldap32v60.a
> collect2: ld returned 1 exit status
> make[2]: *** [libnsldap32v60.so] Error 1
> make[2]: Leaving directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries/libldap'
> make[1]: *** [export] Error 2
> make[1]: Leaving directory `/cygdrive/d/SYMPHONY/mozilla_ldap_c_sdk/
> 6.0.6/mozilla/directory/c-sdk/ldap/libraries'
> make: *** [export] Error 2
> 
> ERROR is at line "os-ip.c:595: undefined reference to
> `_gethostbyname_r'".
> As per the code of os-ip.c (at line 595), there is a macro defined
> that mapped to “gethostbyname_r'” (But no ‘_’ symbol  mentioned in
> macro definition whereas in error the name reported as
> _gethostbyname_r').
> 
> Sample os-ip.c code:
> ------------------------
> #ifdef GETHOSTBYNAME_R_RETURNS_INT
> (void)GETHOSTBYNAME( host, &hent, hbuf,sizeof(hbuf), &hp, &err );
> #else
> hp = GETHOSTBYNAME( host, &hent, hbuf, sizeof(hbuf), &err );
> #endif
> if ( hp != NULL ) {
>                addrlist = hp->h_addr_list;
>                  }
> }
> 
> Sample .h file code:
> ------------------------
> typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
> #define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
> #define GETHOSTBYNAME( n, r, b, l, rp, e )  gethostbyname_r( n, r, b,
> l, rp, e )
> #define GETHOSTBYNAME_R_RETURNS_INT
> #else
> typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
> #define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
> #define GETHOSTBYNAME( n, r, b, l, e )  gethostbyname_r( n, r, b, l,
> e )
> #endif
> 
> Please suggest on same if I am missing anything.

I've never tried using gcc on Windows.  I suspect you are going to have 
to add -lgcc or something like that to the link line.

> 
> Regards,
> Ashwani Saxena