Bug 145501 - cmake error on Solaris in kdepimlibs with ldap/lber
Summary: cmake error on Solaris in kdepimlibs with ldap/lber
Status: RESOLVED FIXED
Alias: None
Product: kontact
Classification: Applications
Component: mail (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 15:07 UTC by Steve Evans
Modified: 2007-06-25 12:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
make ldap depend on lber (557 bytes, patch)
2007-05-16 15:09 UTC, Steve Evans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Evans 2007-05-16 15:07:49 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.4.6 
OS:                Solaris

(This bug is in kdepimlibs, but there is no application entry for that in bugs.kde.org)

I get this error when running cmake on Solaris:

--
----------------------------------------------------------------------------------
-- The following list of OPTIONAL packages were located on your system.         --
-- You will have all the following features available from this software.       --
----------------------------------------------------------------------------------
+ boost
+ OpenLDAP
----------------------------------------------------------------------------------
-- The following list of OPTIONAL packages could NOT be located on your system. --
-- Consider installing them to enable more features from this software.         --
----------------------------------------------------------------------------------
+ cyrus-sasl: Cyrus SASL API <http://asg.web.cmu.edu/sasl/sasl-library.html>
Needed to support authentication of logins

CMake Error: This project requires some variables to be set,
and cmake can not find them.
Please set the following variables:
LBER_LIBRARIES (ADVANCED)

The problem is that Solaris has an implementation of ldap that is not OpenLDAP which cmake incorrectly identifies as being openldap. The solaris ldap does *not* have a liblber, so that is not found.

I worked around it, as I don't need ldap, by changing FindLdap.cmake as in the attached patch so that it only supports ldap if both ldap and lber are found. However I don't think this is correct solution as it will probably break the APPLE specific checks in FindLdap.cmake
Comment 1 Steve Evans 2007-05-16 15:09:11 UTC
Created attachment 20591 [details]
make ldap depend on lber

I *don't* think this is the correct solution, but it stops the solaris version
of ldap from confusing things.
Comment 2 Allen Winter 2007-05-17 01:24:18 UTC
Guess we need some way to distinguish openldap from another ldap
Comment 3 Szombathelyi György 2007-05-17 10:47:36 UTC
Is the LDAP checks in 3.5 works correctly? Then it will be enough to port its logic to FindLDAP.cmake (which makes lber optionally, which of course can fail if openldap installed without lber, but then its a broken install anyway).
Comment 4 Steve Evans 2007-05-17 10:49:54 UTC
I never had a problem with ldap in 3.5 and I built 3.5 on the same machine that I am trying to build the SVN trunk. Therefore I would assume that the 3.5 ldap logic is correct.
Comment 5 Szombathelyi György 2007-05-17 21:20:36 UTC
SVN commit 665745 by gyurco:

Allow build without liblber.

CCBUG: 145501


 M  +5 -2      cmake/modules/FindLdap.cmake  
 M  +1 -1      kldap/CMakeLists.txt  


--- trunk/KDE/kdepimlibs/cmake/modules/FindLdap.cmake #665744:665745
@@ -3,7 +3,7 @@
 #
 #  LDAP_FOUND - system has libldap
 #  LDAP_INCLUDE_DIR - the ldap include directory
-#  LDAP_LIBRARIES - libldap library
+#  LDAP_LIBRARIES - libldap + liblber (if found) library
 #  LBER_LIBRARIES - liblber library
 
 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
@@ -39,11 +39,14 @@
 
 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
    set(LDAP_FOUND TRUE)
+   if(LBER_LIBRARIES)
+     set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES})
+   endif(LBER_LIBRARIES)
 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
 
 if(LDAP_FOUND)
    if(NOT Ldap_FIND_QUIETLY)
-      message(STATUS "Found ldap: ${LDAP_LIBRARIES} ${LBER_LIBRARIES}")
+      message(STATUS "Found ldap: ${LDAP_LIBRARIES}")
    endif(NOT Ldap_FIND_QUIETLY)
 endif(LDAP_FOUND)
 
--- trunk/KDE/kdepimlibs/kldap/CMakeLists.txt #665744:665745
@@ -15,7 +15,7 @@
 set(kldap_EXTRA_INCLUDES)
 
 if (LDAP_FOUND)
-set(kldap_EXTRA_LIBS ${LDAP_LIBRARIES} ${LBER_LIBRARIES})
+set(kldap_EXTRA_LIBS ${LDAP_LIBRARIES})
 set(klap_EXTRA_INCLUDES ${LDAP_INCLUDE_DIR})
 endif (LDAP_FOUND)
 
Comment 6 Allen Winter 2007-05-17 22:23:21 UTC
stevee,
please test and let us know if we can close this bug.
Comment 7 Steve Evans 2007-05-18 11:18:30 UTC
It doesn't quite work :-(

The cmake process succeeds, finding the Solaris version of ldap:

-- Found ldap: /lib/libldap.so

----------------------------------------------------------------------------------
-- The following list of OPTIONAL packages were located on your system.         --
-- You will have all the following features available from this software.       --
----------------------------------------------------------------------------------
+ boost
+ OpenLDAP

However when it tries to build the ldap support it fails badly:

[  9%] Building CXX object kldap/CMakeFiles/kldap.dir/ber.o
In file included from /cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:33:
/usr/include/ldap.h:494: error: field `ldctl_value' has incomplete type
/usr/include/ldap.h:1083: error: `BerElement' has not been declared
/usr/include/ldap.h:1085: error: `BerElement' has not been declared
/usr/include/ldap.h:1115: error: `BerElement' has not been declared
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In constructor `KLDAP::Ber::Ber()':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:50: error: `LBER_USE_DER' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In member function `int KLDAP::Ber::printf(const QString&, ...)':
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:123: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:131: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:137: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:146: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:153: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:160: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:173: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:188: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:201: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:209: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In member function `int KLDAP::Ber::scanf(const QString&, ...)':
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:242: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:251: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:254: error: `ber_memfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:262: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:265: error: `ber_memfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:273: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:285: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:295: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:298: error: `ber_memfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:308: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:318: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:326: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:333: error: `ber_memvfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:341: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:355: error: `BerVarray' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:355: error: expected `;' before "bv"
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:356: error: `bv' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:375: error: at this point in file

Comment 8 Szombathelyi György 2007-05-18 21:22:10 UTC
SVN commit 666099 by gyurco:

As I found out, Solaris needs to include lber.h first. Please test.

CCBUG: 145501


 M  +1 -1      ber.cpp  
 M  +1 -1      ldapconnection.cpp  
 M  +1 -1      ldapoperation.cpp  


--- trunk/KDE/kdepimlibs/kldap/ber.cpp #666098:666099
@@ -30,8 +30,8 @@
 #include <cstdarg>
 
 #ifdef LDAP_FOUND
+#include <lber.h>
 #include <ldap.h>
-#include <lber.h>
 #endif
 
 using namespace KLDAP;
--- trunk/KDE/kdepimlibs/kldap/ldapconnection.cpp #666098:666099
@@ -32,8 +32,8 @@
 
 #ifdef LDAP_FOUND
 #define LDAP_DEPRECATED 1 //for ldap_simple_bind_s
+#include <lber.h>
 #include <ldap.h>
-#include <lber.h>
 #endif
 
 using namespace KLDAP;
--- trunk/KDE/kdepimlibs/kldap/ldapoperation.cpp #666098:666099
@@ -29,8 +29,8 @@
 #include <kdebug.h>
 
 #ifdef LDAP_FOUND
+#include <lber.h>
 #include <ldap.h>
-#include <lber.h>
 #endif
 
 #include <QtCore/QTime>
Comment 9 Szombathelyi György 2007-05-18 21:24:14 UTC
Steve, can you test it now? If it still doesn't work, can you post ldap.h and lber.h to me?
Comment 10 Steve Evans 2007-05-21 11:09:07 UTC
Sorry it still doesn't build:

[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ber.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In constructor `KLDAP::Ber::Ber()':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:50: error: `LBER_USE_DER' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In member function `int KLDAP::Ber::printf(const QString&, ...)':
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:123: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:131: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:137: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:146: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:153: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:160: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:173: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:188: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:201: error: at this point in file
/usr/include/lber.h:183: error: too many arguments to function `int ber_printf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:209: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In member function `int KLDAP::Ber::scanf(const QString&, ...)':
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:242: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:251: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:254: error: `ber_memfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:262: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:265: error: `ber_memfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:273: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:285: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:295: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:298: error: `ber_memfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:308: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:318: error: at this point in file
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:326: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:333: error: `ber_memvfree' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:341: error: at this point in file
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:355: error: `BerVarray' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:355: error: expected `;' before "bv"
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:356: error: `bv' was not declared in this scope
/usr/include/lber.h:154: error: too many arguments to function `ber_tag_t ber_scanf()'
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:375: error: at this point in file
Comment 11 Szombathelyi György 2007-05-21 15:39:34 UTC
Ok, at least only ber.cpp fails now :)
Anyone knows about why ber_printf and ber_scanf fails? I read the docs at
http://bama.ua.edu/cgi-bin/man-cgi?ber_scanf+3LDAP
http://bama.ua.edu/cgi-bin/man-cgi?ber_printf+3LDAP
(Seems these are Solaris 9 docs)

and the definitions are:
ber_printf(BerElement *ber, char **fmt[, arg... ]);
ber_scanf(BerElement **ber, char **fmt [, arg...]);

Also ber_alloc_t mentions:
One option is defined and must always be supplied:
#define LBER_USE_DER 0x01
So I must add this to my sources? Why doesn't lber.h have it?

As I see, ber_memfree and ber_memvfree doesn't exist on Solaris, but I can work-around these.
Comment 12 Steve Evans 2007-05-21 16:38:45 UTC
/usr/include/lber.h on Solaris defines the prototypes for ber_printf and ber_scanf as:

#if defined(MACOS) || defined(BC31) || defined(_WIN32)
int ber_printf(BerElement *ber, char *fmt, ...);
#else
int ber_printf();
#endif

#if defined(MACOS) || defined(BC31) || defined(_WIN32)
ber_tag_t ber_scanf(BerElement *ber, char *fmt, ...);
#else
ber_tag_t ber_scanf();
#endif

Now I wouldn't expect MACOS or _WIN32 to be defined on Solaris and I cannot find anywhere that defines BC31, plus the man page the ber_ functions makes no mention of it. So you we are probably getting the non prototype versions :-(

Adding definitions of BC31 and LBER_USE_DER reduces the compile errors to the free functions and a missing definition of BerVarray:

[  9%] Building CXX object kldap/CMakeFiles/kldap.dir/ber.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In member function `int KLDAP::Ber::scanf(const QString&, ...)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:256: error: `ber_memfree' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:267: error: `ber_memfree' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:300: error: `ber_memfree' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:335: error: `ber_memvfree' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:357: error: `BerVarray' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:357: error: expected `;' before "bv"
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:358: error: `bv' was not declared in this scope
Comment 13 Szombathelyi György 2007-05-21 20:48:50 UTC
SVN commit 667062 by gyurco:

- Added some macros - Solaris needs them - What's BC31?
- replace ber_memvfree - seems OpenLDAP specific
- Also remove 'W' format string from ber_scanf, also OpenLDAP specific

CCBUG: 145501


 M  +16 -18    ber.cpp  
 M  +1 -1      ber.h  


--- trunk/KDE/kdepimlibs/kldap/ber.cpp #667061:667062
@@ -30,10 +30,24 @@
 #include <cstdarg>
 
 #ifdef LDAP_FOUND
+
+#ifdef Q_OS_SOLARIS
+#define BC31 1
+#endif
+
 #include <lber.h>
 #include <ldap.h>
+
+#ifndef LBER_USE_DER
+#define LBER_USE_DER 1
 #endif
 
+#ifndef ber_memfree
+#define ber_memfree(x) ldap_memfree(x)
+#endif
+
+#endif
+
 using namespace KLDAP;
 
 class Ber::BerPrivate {
@@ -328,9 +342,10 @@
             c2 = c;
             while ( *c ) {
               v->append( QByteArray( *c ) );
+              ber_memfree( *c );
               c++;
             }
-            ber_memvfree( (void**) c2 );
+            ber_memfree( c2 );
           }
           break;
         }
@@ -349,23 +364,6 @@
           }
           break;
         }
-      case 'W':
-        {
-          QList<QByteArray> *W = va_arg( args, QList<QByteArray> * );
-          BerVarray bv;
-          ret = ber_scanf( d->mBer, fmt, &bv );
-          if ( ret != -1 && bv ) {
-            int j = 0;
-            while ( bv[j].bv_val ) {
-              W->append( QByteArray( bv[j].bv_val, bv[j].bv_len ) );
-              j++;
-            }
-//            ber_bvarray_free( bv );
-          }
-
-          break;
-        }
-//      case 'M': //This is so complicated, I'm lazy to implement. Use the 3 above instead.
       case 'x':
       case 'n':
       case '{':
--- trunk/KDE/kdepimlibs/kldap/ber.h #667061:667062
@@ -94,7 +94,7 @@
      *     is provided. This works across calls.
      *   </li>
      *   <li>
-     *     v,V,W  Several octet strings. A QList<QByteArray>* is supplied.
+     *     v,V  Several octet strings. A QList<QByteArray>* is supplied.
      *     Note that a construct like ’{v}’ is required to get an actual
      *     SEQUENCE OF octet strings. Also note that the 'v' format recognizes
      *     the QByteArray only to the first zero character, so it's not
Comment 14 Steve Evans 2007-05-22 10:28:25 UTC
That is so close, I now get one error:

[  9%] Building CXX object kldap/CMakeFiles/kldap.dir/ber.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp: In member function `int KLDAP::Ber::scanf(const QString&, ...)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ber.cpp:335: error: cannot convert `char**' to `char*' for argument `1' to `void ldap_memfree(char*)'
Comment 15 Szombathelyi György 2007-05-22 20:32:29 UTC
SVN commit 667408 by gyurco:

Allow to compile on Solaris - the last bits. Don't close the bug till
it shows that these changes actually work - I'll write some test code, and
if it's passed, the bug should be closed finally...

CCBUG: 145501


 M  +1 -1      ber.cpp  
 M  +1 -1      ldapoperation.cpp  


--- trunk/KDE/kdepimlibs/kldap/ber.cpp #667407:667408
@@ -332,7 +332,7 @@
               ber_memfree( *c );
               c++;
             }
-            ber_memfree( c2 );
+            ber_memfree( (char*) c2 );
           }
           break;
         }
--- trunk/KDE/kdepimlibs/kldap/ldapoperation.cpp #667407:667408
@@ -235,7 +235,7 @@
           ldap_memfree( *tmp );
           tmp++;
         }
-        ldap_memfree( referralsp );
+        ldap_memfree( (char*) referralsp );
       }
       mMatchedDn = QString();
       if ( matcheddn ) {
Comment 16 Steve Evans 2007-05-23 11:05:49 UTC
I now get errors in ldapconnection.cpp:

[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapconnection.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `bool KLDAP::LdapConnection::setSizeLimit(int)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:150: error: `LDAP_OPT_SUCCESS' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `int KLDAP::LdapConnection::sizeLimit() const':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:160: error: `LDAP_OPT_SUCCESS' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `bool KLDAP::LdapConnection::setTimeLimit(int)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:170: error: `LDAP_OPT_SUCCESS' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `int KLDAP::LdapConnection::timeLimit() const':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:180: error: `LDAP_OPT_SUCCESS' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `int KLDAP::LdapConnection::connect()':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:266: error: `ldap_initialize' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:273: error: `LDAP_OPT_SUCCESS' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:284: error: `ldap_start_tls_s' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `int KLDAP::LdapConnection::bind(int (*)(KLDAP::LdapConnection::SASL_Credentials&, void*), void*)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:345: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:345: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `void KLDAP::LdapConnection::close()':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:353: error: `ldap_unbind_ext_s' was not declared in this scope
d
Comment 17 Szombathelyi György 2007-05-23 20:27:06 UTC
SVN commit 667726 by gyurco:

Another set of compatibility fixes with other client libs than OpenLDAP...

CCBUG: 145501


 M  +10 -1     CMakeLists.txt  
 M  +1 -1      ber.cpp  
 M  +3 -0      kldap_config.h.cmake  
 M  +18 -2     ldapconnection.cpp  


--- trunk/KDE/kdepimlibs/kldap/CMakeLists.txt #667725:667726
@@ -9,7 +9,6 @@
 macro_log_feature(SASL2_FOUND "cyrus-sasl" "Cyrus SASL API" "http://asg.web.cmu.edu/sasl/sasl-library.html" FALSE "" "Needed to support authentication of logins" )
 
 check_include_files(sys/time.h    HAVE_SYS_TIME_H)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kldap_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kldap_config.h )
 
 set(kldap_EXTRA_LIBS)
 set(kldap_EXTRA_INCLUDES)
@@ -17,6 +16,14 @@
 if (LDAP_FOUND)
 set(kldap_EXTRA_LIBS ${LDAP_LIBRARIES})
 set(klap_EXTRA_INCLUDES ${LDAP_INCLUDE_DIR})
+
+set(CMAKE_REQUIRED_INCLUDES lber.h ldap.h)
+set(CMAKE_REQUIRED_LIBRARIES ${LDAP_LIBRARIES})
+check_function_exists(ldap_start_tls_s HAVE_LDAP_START_TLS_S)
+check_function_exists(ldap_initialize HAVE_LDAP_INITIALIZE)
+check_function_exists(ber_memfree HAVE_BER_MEMFREE)
+
+
 endif (LDAP_FOUND)
 
 if (SASL2_FOUND)
@@ -24,6 +31,8 @@
 set(kldap_EXTRA_INCLUDES ${kldap_EXTRA_INCLUDES} ${SASL2_INCLUDE_DIR})
 endif (SASL2_FOUND)
 
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kldap_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kldap_config.h )
+
 add_subdirectory(tests)
 
 ########### next target ###############
--- trunk/KDE/kdepimlibs/kldap/ber.cpp #667725:667726
@@ -42,7 +42,7 @@
 #define LBER_USE_DER 1
 #endif
 
-#ifndef ber_memfree
+#ifndef HAVE_BER_MEMFREE
 #define ber_memfree(x) ldap_memfree(x)
 #endif
 
--- trunk/KDE/kdepimlibs/kldap/kldap_config.h.cmake #667725:667726
@@ -1,3 +1,6 @@
 #cmakedefine LDAP_FOUND
 #cmakedefine SASL2_FOUND
 #cmakedefine HAVE_SYS_TIME_H
+#cmakedefine HAVE_LDAP_START_TLS_S
+#cmakedefine HAVE_LDAP_INITIALIZE
+#cmakedefine HAVE_BER_MEMFREE
--- trunk/KDE/kdepimlibs/kldap/ldapconnection.cpp #667725:667726
@@ -34,8 +34,13 @@
 #define LDAP_DEPRECATED 1 //for ldap_simple_bind_s
 #include <lber.h>
 #include <ldap.h>
+
+#ifndef LDAP_OPT_SUCCESS
+#define LDAP_OPT_SUCCESS 0
 #endif
 
+#endif
+
 using namespace KLDAP;
 
 class LdapConnection::LdapConnectionPrivate
@@ -263,7 +268,12 @@
   url += ':';
   url += QString::number( d->mServer.port() );
   kDebug(5322) << "ldap url: " << url << endl;
+#ifdef HAVE_LDAP_INITIALIZE
   ret = ldap_initialize( &d->mLDAP, url.toLatin1() );
+#else
+  d->mLDAP = ldap_init( d->mServer.host().toLatin1().data(), d->mServer.port() );
+  if ( d->mLDAP == 0 ) ret = -1;
+#endif
   if ( ret != LDAP_SUCCESS ) {
     d->mConnectionError = i18n("An error occurred during the connection initialization phase.");
     return ret;
@@ -281,11 +291,17 @@
   kDebug(5322) << "setting security to: " << d->mServer.security() << endl;
   if ( d->mServer.security() == LdapServer::TLS ) {
     kDebug(5322) << "start TLS" << endl;
+#ifdef HAVE_LDAP_START_TLS_S
     if ( ( ret = ldap_start_tls_s( d->mLDAP, NULL, NULL ) ) != LDAP_SUCCESS ) {
       close();
       d->mConnectionError = i18n("Cannot start TLS.");
       return ret;
     }
+#else
+    close();
+    d->mConnectionError = i18n("TLS support not available in the LDAP client libraries.");
+    return -1;
+#endif
   }
 
   kDebug(5322) << "setting sizelimit to: " << d->mServer.sizeLimit() << endl;
@@ -342,7 +358,7 @@
       pass = d->mServer.password();
     }
     kDebug(5322) << "binding to server, bindname: " << bindname << " password: *****" << endl;
-    ret = ldap_simple_bind_s( d->mLDAP, bindname.toUtf8(), pass.toUtf8() );
+    ret = ldap_simple_bind_s( d->mLDAP, bindname.toUtf8().data(), pass.toUtf8().data() );
   }
   return ret;
 }
@@ -350,7 +366,7 @@
 void LdapConnection::close()
 {
   if ( d->mLDAP ) {
-    ldap_unbind_ext_s( d->mLDAP, 0, 0 );
+    ldap_unbind_ext( d->mLDAP, 0, 0 );
   }
   d->mLDAP = 0;
   kDebug(5322) << "connection closed!" << endl;
Comment 18 Szombathelyi György 2007-05-23 20:28:20 UTC
Stevee, please check this with make -k, so we can see all errors.
Comment 19 Steve Evans 2007-05-24 12:27:45 UTC
I now get these errors when using make -k

Scanning dependencies of target kldap
[  9%] Building CXX object kldap/CMakeFiles/kldap.dir/ber.o
[  9%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapconnection.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp: In member function `void KLDAP::LdapConnection::close()':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp:369: error: `ldap_unbind_ext' was not declared in this scope
distcc[25189] ERROR: compile /cad4/stevee/kde-svn/kdepimlibs/kldap/ldapconnection.cpp on rooster/3 failed
gmake[2]: *** [kldap/CMakeFiles/kldap.dir/ldapconnection.o] Error 1
[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapoperation.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::search(const KLDAP::LdapDN&, KLDAP::LdapUrl::Scope, const QString&, const QStringList&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:438: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:438: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::add(const KLDAP::LdapObject&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:479: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::add_s(const KLDAP::LdapObject&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:511: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::rename(const KLDAP::LdapDN&, const QString&, const QString&, bool)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:533: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:533: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::rename_s(const KLDAP::LdapDN&, const QString&, const QString&, bool)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:556: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:556: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::del(const KLDAP::LdapDN&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:575: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::del_s(const KLDAP::LdapDN&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:595: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::modify(const KLDAP::LdapDN&, const QList<KLDAP::LdapOperation::ModOp>&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:636: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::modify_s(const KLDAP::LdapDN&, const QList<KLDAP::LdapOperation::ModOp>&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:679: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::compare(const KLDAP::LdapDN&, const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:705: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:705: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::compare_s(const KLDAP::LdapDN&, const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:734: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:734: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::exop(const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:761: error: `ldap_extended_operation' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::exop_s(const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:792: error: `ldap_extended_operation_s' was not declared in this scope
distcc[25195] ERROR: compile /cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp on rooster/3 failed
gmake[2]: *** [kldap/CMakeFiles/kldap.dir/ldapoperation.o] Error 1
[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapcontrol.o
[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapsearch.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapconfigwidget.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapdn.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapmodeltreeitem_p.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapmodel.o
[ 12%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapmodel_p.o
gmake[2]: Target `kldap/CMakeFiles/kldap.dir/build' not remade because of errors.
gmake[1]: *** [kldap/CMakeFiles/kldap.dir/all] Error 2
Comment 20 Szombathelyi György 2007-05-24 17:26:07 UTC
SVN commit 667954 by gyurco:

Check for some more ldap_ functions.

CCBUG: 145501


 M  +3 -0      CMakeLists.txt  
 M  +3 -0      kldap_config.h.cmake  
 M  +4 -0      ldapconnection.cpp  
 M  +10 -0     ldapoperation.cpp  


--- trunk/KDE/kdepimlibs/kldap/CMakeLists.txt #667953:667954
@@ -22,6 +22,9 @@
 check_function_exists(ldap_start_tls_s HAVE_LDAP_START_TLS_S)
 check_function_exists(ldap_initialize HAVE_LDAP_INITIALIZE)
 check_function_exists(ber_memfree HAVE_BER_MEMFREE)
+check_function_exists(ldap_unbind_ext HAVE_LDAP_UNBIND_EXT)
+check_function_exists(ldap_extended_operation HAVE_LDAP_EXTENDED_OPERATION)
+check_function_exists(ldap_extended_operation_s HAVE_LDAP_EXTENDED_OPERATION_S)
 
 
 endif (LDAP_FOUND)
--- trunk/KDE/kdepimlibs/kldap/kldap_config.h.cmake #667953:667954
@@ -4,3 +4,6 @@
 #cmakedefine HAVE_LDAP_START_TLS_S
 #cmakedefine HAVE_LDAP_INITIALIZE
 #cmakedefine HAVE_BER_MEMFREE
+#cmakedefine HAVE_LDAP_UNBIND_EXT
+#cmakedefine HAVE_LDAP_EXTENDED_OPERATION
+#cmakedefine HAVE_LDAP_EXTENDED_OPERATION_S
--- trunk/KDE/kdepimlibs/kldap/ldapconnection.cpp #667953:667954
@@ -366,7 +366,11 @@
 void LdapConnection::close()
 {
   if ( d->mLDAP ) {
+#ifdef HAVE_LDAP_UNBIND_EXT
     ldap_unbind_ext( d->mLDAP, 0, 0 );
+#else
+    ldap_unbind( d->mLDAP );
+#endif
   }
   d->mLDAP = 0;
   kDebug(5322) << "connection closed!" << endl;
--- trunk/KDE/kdepimlibs/kldap/ldapoperation.cpp #667953:667954
@@ -743,6 +743,10 @@
 int LdapOperation::exop( const QString &oid, const QByteArray &data )
 {
   Q_ASSERT( d->mConnection );
+#ifndef HAVE_LDAP_EXTENDED_OPERATION
+  kError() << "Your LDAP client libraries don't support extended operations." << endl;
+  return -1;
+#else
   LDAP *ld = (LDAP*) d->mConnection->handle();
   int msgid;
 
@@ -768,10 +772,15 @@
     retval = msgid;
   }
   return retval;
+#endif
 }
 
 int LdapOperation::exop_s( const QString &oid, const QByteArray &data )
 {
+#ifndef HAVE_LDAP_EXTENDED_OPERATION_S
+  kError() << "Your LDAP client libraries don't support extended operations." << endl;
+  return -1;
+#else
   Q_ASSERT( d->mConnection );
   LDAP *ld = (LDAP*) d->mConnection->handle();
   BerValue *retdata;
@@ -798,6 +807,7 @@
   ldap_controls_free( clientctrls );
 
   return retval;
+#endif
 }
 
 int LdapOperation::abandon( int id )
Comment 21 Steve Evans 2007-05-24 18:35:13 UTC
Getting closer:

Scanning dependencies of target kldap
[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ber.o
[ 10%] Building CXX object kldap/CMakeFiles/kldap.dir/ldif.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapurl.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapserver.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapobject.o
[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapconnection.o
[ 12%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapoperation.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::rename(const KLDAP::LdapDN&, const QString&, const QString&, bool)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:533: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::rename_s(const KLDAP::LdapDN&, const QString&, const QString&, bool)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:556: error: conversion from `QByteArray' to `char*' is ambiguous
/opt/qt/include/QtCore/qbytearray.h:342: note: candidates are: QByteArray::operator const char*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:344: note:                 QByteArray::operator const void*() const <near match>
/opt/qt/include/QtCore/qbytearray.h:308: note:                 QByteArray::operator QNoImplicitBoolCast() const <near match>
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::exop(const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:765: error: `ldap_extended_operation' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::exop_s(const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:801: error: `ldap_extended_operation_s' was not declared in this scope
distcc[26384] ERROR: compile /cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp on rooster/3 failed
gmake[2]: *** [kldap/CMakeFiles/kldap.dir/ldapoperation.o] Error 1
Comment 22 Szombathelyi György 2007-05-25 00:22:44 UTC
Strange, do you have
#define HAVE_LDAP_EXTENDED_OPERATION
in your kldap_config.h in the build dir?
Can you try to re-run cmake and notice if ldap_extended_operation found?
Comment 23 Steve Evans 2007-05-25 10:27:51 UTC
Yes, HAVE_LDAP_EXTENDED_OPERATION is defined, even after a re-run cmake
Comment 24 Szombathelyi György 2007-05-25 19:13:38 UTC
Strange...where is it defined?
Comment 25 Steve Evans 2007-05-29 10:52:24 UTC
It is defined in kldap/kldap_config.h

cmake seems to think it exists:

-- Looking for ldap_extended_operation
-- Looking for ldap_extended_operation - found
-- Looking for ldap_extended_operation_s
-- Looking for ldap_extended_operation_s - found

so it appears that the check for the functions existence in kldap/CMakeLists.txt is giving the wrong answer.

I blew away my kdepimlibs build and started again, just to be sure, but this gave the same result.
Comment 26 Szombathelyi György 2007-05-29 19:14:08 UTC
It is ok that it defined in kldap_config.h. But what system header? Can you do a grep in /usr/include or wherever the system header files are located for ldap_extended_operation? Maybe it needs a funny #define again, like for ber_scanf and ber_printf. Also can you try to re-run cmake, but delete CMakeCache.txt before? Thanks for your patience anyway :)
Comment 27 Steve Evans 2007-05-30 10:51:57 UTC
I cannot find ldap_extended_operation in any system header file. I looked in /usr/include, /usr/openwin/include, /usr/ucbinclude

Run cmake after deleting CMakeCache.txt gives the same result
Comment 28 Szombathelyi György 2007-05-30 12:23:31 UTC
That strange that the same checks work for ldap_unbind_ext, ldap_initialize, ldap_start_tls_s, but not for ldap_extended_operation...I fear that I cannot solve it myself...anyone with some CMake+Solaris experience?
Comment 29 Steve Evans 2007-05-30 12:49:58 UTC
Is there any way of seeing what cmake is doing in detail? In the older ./configure process the config.log file contained lots of info that could help with these kind of problems.
Comment 30 Szombathelyi György 2007-05-30 18:51:02 UTC
It's in builddir/CMakeFiles/CMakeOutput.log. Can you paste an output of a failed test plus the output of ldap_extended_operation?
It's basically compile & link a small C program /usr/share/cmake/Modules/CheckFunctionExists.c
Here's mine:

Determining if the function ldap_extended_operation exists passed with the following output:
gmake[1]: Entering directory `/home/gyuri/svn/kdepimlibs/build/CMakeFiles/CMakeTmp'
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[2]: Entering directory `/home/gyuri/svn/kdepimlibs/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/gyuri/svn/kdepimlibs/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/usr/share/cmake/Modules/CheckFunctionExists.o
/usr/bin/gcc  -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
-Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common  -DCHECK_FUNCTION_EXISTS=l
dap_extended_operation -I/home/gyuri/svn/kdepimlibs/build/CMakeFiles/CMakeTmp/lber.h -I/home/gyuri/svn/kdepimlibs/build/CMak
eFiles/CMakeTmp/ldap.h   -o CMakeFiles/cmTryCompileExec.dir/usr/share/cmake/Modules/CheckFunctionExists.o   -c /usr/share/cm
ake/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec
/usr/bin/cmake -P CMakeFiles/cmTryCompileExec.dir/cmake_clean_target.cmake
/usr/bin/gcc     -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscrip
ts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common  -DCHECK_FUNCTION_EXIST
S=ldap_extended_operation  -fPIC "CMakeFiles/cmTryCompileExec.dir/usr/share/cmake/Modules/CheckFunctionExists.o"   -o cmTryC
ompileExec -rdynamic -L/usr/lib64 -lldap -llber -Wl,-rpath,/usr/lib64
gmake[2]: Leaving directory `/home/gyuri/svn/kdepimlibs/build/CMakeFiles/CMakeTmp'
gmake[1]: Leaving directory `/home/gyuri/svn/kdepimlibs/build/CMakeFiles/CMakeTmp'
Comment 31 Steve Evans 2007-05-31 10:49:39 UTC
The problem seems to be that the function exists in the library:

nm /usr/lib/libldap.so | grep ldap_extended_operation
[717]   |    102264|     380|FUNC |GLOB |0    |9      |ldap_extended_operation
[937]   |    102644|     148|FUNC |GLOB |0    |9      |ldap_extended_operation_s

but there is no prototype for it.

When cmake checks the existence of ldap_extended_operation it compiles with a dummy prototype, so that works and the link then works so it treats the function as being present.

The C++ compile of the code then fails because there is no prototype.
Comment 32 Steve Evans 2007-05-31 11:28:24 UTC
Some more information: I just checked a Solaris 9 machine and it does have prototypes for the functions in /usr/include/ldap.h

So it looks as though its a bug in Solaris 8. Unfortunately all of the machines we have running KDE are on Solaris 8 so I have to build on 8 :-(
Comment 33 Szombathelyi György 2007-05-31 21:41:50 UTC
SVN commit 670226 by gyurco:

Check for the prototype for ldap_extended_operation[_s], too, since there are
broken client libs, which has the symbol in libldap, but not the protoype in
ldap.h (Solaris 8)

CCBUG: 145501


 M  +3 -0      CMakeLists.txt  
 M  +2 -0      kldap_config.h.cmake  
 M  +8 -8      ldapoperation.cpp  


--- trunk/KDE/kdepimlibs/kldap/CMakeLists.txt #670225:670226
@@ -1,5 +1,6 @@
 project(kldap)
 include(CheckFunctionExists)
+include(CheckSymbolExists)
 
 macro_optional_find_package(Ldap)
 macro_log_feature(LDAP_FOUND "OpenLDAP" "LDAP (Lightweight Directory Access Protocol) libraries" "http://www.openldap.org" FALSE "" "Needed to provide LDAP functionality in KDE" )
@@ -24,6 +25,8 @@
 check_function_exists(ldap_unbind_ext HAVE_LDAP_UNBIND_EXT)
 check_function_exists(ldap_extended_operation HAVE_LDAP_EXTENDED_OPERATION)
 check_function_exists(ldap_extended_operation_s HAVE_LDAP_EXTENDED_OPERATION_S)
+check_symbol_exists(ldap_extended_operation ldap.h HAVE_LDAP_EXTENDED_OPERATION_PROTOTYPE)
+check_symbol_exists(ldap_extended_operation_s ldap.h HAVE_LDAP_EXTENDED_OPERATION_S_PROTOTYPE)
 
 
 endif (LDAP_FOUND)
--- trunk/KDE/kdepimlibs/kldap/kldap_config.h.cmake #670225:670226
@@ -7,3 +7,5 @@
 #cmakedefine HAVE_LDAP_UNBIND_EXT
 #cmakedefine HAVE_LDAP_EXTENDED_OPERATION
 #cmakedefine HAVE_LDAP_EXTENDED_OPERATION_S
+#cmakedefine HAVE_LDAP_EXTENDED_OPERATION_PROTOTYPE
+#cmakedefine HAVE_LDAP_EXTENDED_OPERATION_S_PROTOTYPE
--- trunk/KDE/kdepimlibs/kldap/ldapoperation.cpp #670225:670226
@@ -743,10 +743,7 @@
 int LdapOperation::exop( const QString &oid, const QByteArray &data )
 {
   Q_ASSERT( d->mConnection );
-#ifndef HAVE_LDAP_EXTENDED_OPERATION
-  kError() << "Your LDAP client libraries don't support extended operations." << endl;
-  return -1;
-#else
+#ifdef HAVE_LDAP_EXTENDED_OPERATION && HAVE_LDAP_EXTENDED_OPERATION_PROTOTYPE
   LDAP *ld = (LDAP*) d->mConnection->handle();
   int msgid;
 
@@ -772,15 +769,15 @@
     retval = msgid;
   }
   return retval;
+#else
+  kError() << "Your LDAP client libraries don't support extended operations." << endl;
+  return -1;
 #endif
 }
 
 int LdapOperation::exop_s( const QString &oid, const QByteArray &data )
 {
-#ifndef HAVE_LDAP_EXTENDED_OPERATION_S
-  kError() << "Your LDAP client libraries don't support extended operations." << endl;
-  return -1;
-#else
+#ifdef HAVE_LDAP_EXTENDED_OPERATION_S && HAVE_LDAP_EXTENDED_OPERATION_S_PROTOTYPE
   Q_ASSERT( d->mConnection );
   LDAP *ld = (LDAP*) d->mConnection->handle();
   BerValue *retdata;
@@ -807,6 +804,9 @@
   ldap_controls_free( clientctrls );
 
   return retval;
+#else
+  kError() << "Your LDAP client libraries don't support extended operations." << endl;
+  return -1;
 #endif
 }
 
Comment 34 Steve Evans 2007-06-01 10:37:45 UTC
Unfortunately there seems to be a problem with your change:

[ 11%] Building CXX object kldap/CMakeFiles/kldap.dir/ldapoperation.o
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:746:37: warning: extra tokens at end of #ifdef directive
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::exop(const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:762: error: `ldap_extended_operation' was not declared in this scope
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:780:39: warning: extra tokens at end of #ifdef directive
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp: In member function `int KLDAP::LdapOperation::exop_s(const QString&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kldap/ldapoperation.cpp:798: error: `ldap_extended_operation_s' was not declared in this scope

I guess that the two lines like:

#ifdef HAVE_LDAP_EXTENDED_OPERATION && HAVE_LDAP_EXTENDED_OPERATION_PROTOTYPE

should be:

#if defined(HAVE_LDAP_EXTENDED_OPERATION) && defined(HAVE_LDAP_EXTENDED_OPERATION_PROTOTYPE)


Comment 35 Szombathelyi György 2007-06-25 10:38:18 UTC
I added these changes some weeks ago, still cannot compile kldap?
Comment 36 Steve Evans 2007-06-25 10:56:29 UTC
It now compiles fine, thanks for all your help
Comment 37 Thomas McGuire 2007-06-25 12:46:58 UTC
>It now compiles fine, thanks for all your help 
I'll close this bug report then.