On 01/25/2011 11:00 AM, Mark Craig wrote:
Hello,
I am trying to compile the LDAP C SDK, but failing to compile convutf8.cpp
as shown inline. What should I do differently to get the C SDK to compile?
Mac OS X 10.5.8
Xcode 3.1.4 developer tools
I put all the code next to my NetBeans projects. Yet I am compiling from the
command line for now.
First I do the NSS step, getting the code from CVS. This all seems to work
fine.
export CVSROOT=:pserver:[email protected]:/cvsroot
cvs co mozilla/nsprpub
cvs co mozilla/security/coreconf mozilla/security/nss mozilla/security/dbm
mozilla/dbm
cd mozilla/security/nss/
make nss_build_all
Autoconf for the C SDK seems to find NSS and NSPR. But then something goes
haywire with convutf8.cpp...
hg clone http://hg.mozilla.org/projects/ldap-sdks/ mozilla/directory
cd mozilla/directory/c-sdk
./configure --with-nss --with-nspr --enable-clu
make
c++ -o convutf8.o -c -pipe -Wmost -fno-common -pthread -O -UDEBUG
-DNDEBUG=1 -DXP_UNIX=1 -DDARWIN=1 -DHAVE_BSD_FLOCK=1 -Di386=1
-DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETNAMEINFO=1
-DNET_SSL -DNO_LIBLCACHE -DLDAP_REFERRALS -DNS_DOMESTIC
-DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
-I/Users/mark/NetBeansProjects/mozilla/dist/public/nss
-I/Users/mark/NetBeansProjects/mozilla/dist/Darwin9.8.0_DBG.OBJ/include
-I../../../../../dist/public/ldap -I../../../ldap/include convutf8.cpp
convutf8.cpp: In function 'char* convert_to_utf8(const char*, const char*)':
convutf8.cpp:236: error: invalid conversion from 'const char**' to 'char**'
convutf8.cpp:236: error: initializing argument 2 of 'size_t iconv(void*,
char**, size_t*, char**, size_t*)'
convutf8.cpp:239: error: invalid conversion from 'const char**' to 'char**'
convutf8.cpp:239: error: initializing argument 2 of 'size_t iconv(void*,
char**, size_t*, char**, size_t*)'
convutf8.cpp:242: error: invalid conversion from 'const char**' to 'char**'
convutf8.cpp:242: error: initializing argument 2 of 'size_t iconv(void*,
char**, size_t*, char**, size_t*)'
make[2]: *** [convutf8.o] Error 1
make[1]: *** [export] Error 2
make: *** [export] Error 2
Thanks for your help.
Looks like convutf8.cpp was not ported to this platform. Note that
--enable-clu is not used for Thunderbird builds which is probably why no
one has seen this before. The problem is here beginning on line 90:
/* Type used for the src parameter to iconv() (the 2nd parameter) */
#if defined(_HPUX_SOURCE) || defined(__GLIBC__)
#define LDAPTOOL_ICONV_SRC_TYPE char ** /* HP/UX and glibc (Linux) */
#else
#define LDAPTOOL_ICONV_SRC_TYPE const char ** /* all others */
#endif
Looks like on this platform the iconv() function expects char ** not
const char **. Since you're not using HPUX or GLIBC,
LDAPTOOL_ICONV_SRC_TYPE is being defined as const char **.
If you can edit the source or add a patch, you could add an
#ifndef LDAPTOOL_ICONV_SRC_TYPE
...
#endif
block around this code, and add a define of
#define LDAPTOOL_ICONV_SRC_TYPE char **
wherever you set your defines/build flags for your project.
Regards,
Mark
Cheers, Mark!
_______________________________________________
dev-tech-ldap mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-ldap