Re: convutf8.cpp:236: error: invalid conversion from 'const char**' to 'char**'
Rich Megginson <[email protected]> Wed, 26 Jan 2011 08:19:31 -0700
| Newsgroups | gmane.comp.mozilla.devel.directory |
|---|---|
| Message-ID | <[email protected]> |
On 01/26/2011 01:59 AM, Mark Craig wrote: > Thanks Rich, > > Anton, (if you are still following these discussions) does what I have > done inline look like the right thing to be doing on Mac OS X? > > In mozilla/directory/c-sdk/ldap/clients/tools/convutf8.cpp, I made a > small change based on your suggestion, Rich. > > /* Type used for the src parameter to iconv() (the 2nd parameter) */ > -#if defined(_HPUX_SOURCE) || defined(__GLIBC__) > +#if defined(_HPUX_SOURCE) || defined(__GLIBC__) || defined(DARWIN) > > That fixed my compilation problem. Yet I found another issue with the binaries. > > $ cd /Users/mark/NetBeansProjects/mozilla/dist > $ export DYLD_LIBRARY_PATH=/Users/mark/NetBeansProjects/mozilla/dist/Darwin9.8.0_DBG.OBJ/lib > $ ./bin/ldapsearch -p 1389 -b dc=example,dc=com uid=user.0 > ldapsearch: conversion from 646 to UTF-8 is not supported > ldapsearch: warning: no conversion of filter to UTF-8 > ldapsearch: conversion from 646 to UTF-8 is not supported > ldapsearch: warning: no conversion of base DN to UTF-8 > > So I made an additional change to convutf8.cpp. Here's the diff > showing both changes. > > $ hg diff ldap/clients/tools/convutf8.cpp > diff -r 3f7d52e53a9d c-sdk/ldap/clients/tools/convutf8.cpp > --- a/c-sdk/ldap/clients/tools/convutf8.cpp Thu Jan 06 12:12:22 2011 +0000 > +++ b/c-sdk/ldap/clients/tools/convutf8.cpp Wed Jan 26 09:47:53 2011 +0100 > @@ -83,13 +83,15 @@ > #elif defined(_WIN32) > #define LDAPTOOL_CHARSET_DEFAULT "windows-1252" /* Windows */ > #define LDAPTOOL_CHARSET_WINANSI "ANSI" /* synonym */ > +#elif defined(DARWIN) > +#define LDAPTOOL_CHARSET_DEFAULT "UTF-8" /* Mac OS X */ > #else > #define LDAPTOOL_CHARSET_DEFAULT "646" /* all others */ > #endif > > /* 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) */ > +#if defined(_HPUX_SOURCE) || defined(__GLIBC__) || defined(DARWIN) > +#define LDAPTOOL_ICONV_SRC_TYPE char ** /* HP/UX, glibc (Linux), and > Mac OS X */ > #else > #define LDAPTOOL_ICONV_SRC_TYPE const char ** /* all others */ > #endif These diffs look fine to me. > > Now, after I compile again, at least ldapsearch seems to work. > > $ ./bin/ldapsearch -p 1389 -b dc=example,dc=com uid=user.0 > version: 1 > dn: uid=user.0,ou=People,dc=example,dc=com > postalAddress: Aaccf Amar$01251 Chestnut Street$Panama City, DE 50369 > postalCode: 50369 > uid: user.0 > description: This is the description for Aaccf Amar. > employeeNumber: 0 > initials: ASA > givenName: Aaccf > objectClass: person > objectClass: inetorgperson > objectClass: organizationalperson > objectClass: top > pager: +1 779 041 6341 > mobile: +1 010 154 3228 > cn: Aaccf Amar > telephoneNumber: +1 685 622 6202 > sn: Amar > street: 01251 Chestnut Street > homePhone: +1 225 216 5900 > mail: [email protected] > l: Panama City > st: DE > > Again, thanks for getting me unstuck. Hope you're having a good new year. Yes, thanks. And I hope things are going well for you. > > Regards, > Mark > > On Wed, Jan 26, 2011 at 4:19 AM, Rich Megginson > <[email protected]> wrote: >> >> 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