Personal tools
Contact Us 24/7 > 1 866.SIX FEET
Sections

Skip to content. | Skip to navigation

Home > Blog > Installing python-ldap with buildout and a system installed OpenLDAP

Blog

Installing python-ldap with buildout and a system installed OpenLDAP

written by Clayton Parker on Wednesday January 5, 2011
Comments | Filed under: , , ,

In our use of buildout, we try not to compile every dependent library that is needed. One example of this is LDAP. Instead of putting the responsibility of upgrading OpenLDAP on the buildout, we depend on the OS specific package managers to take care of this. There are several reasons you would want to do this:

  • Upgrading does not require any changes to your application's build
  • OS specific patches will be applied
  • OS specific configuration arguments will be handled by the package manager
  • Dependencies will be handled by the package manager

If you are using zc.buildout, then you can use the zc.recipe.egg recipe to ensure the package gets the proper library paths. Right now, if you try to install python-ldap on FreeBSD, you will get an error.

$ mkvirtualenv ldap
(ldap)$ pip install python-ldap
Downloading/unpacking python-ldap
  Downloading python-ldap-2.3.12.tar.gz (112Kb): 112Kb downloaded
  Storing download in cache at /home/clayton/.pip_download_cache/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpython-ldap%2Fpython-ldap-2.3.12.tar.gz
  Running setup.py egg_info for package python-ldap
    extra_compile_args:
    extra_objects:
    include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl
    library_dirs: /usr/local/openldap-2.3/lib
    libs: ldap_r lber sasl2 ssl crypto
    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found
    warning: no files found matching 'Makefile'
    warning: no files found matching 'Modules/LICENSE'
Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/home/clayton/.virtualenvs/ldap/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg (from python-ldap)
Installing collected packages: python-ldap
  Running setup.py install for python-ldap
    extra_compile_args:
    extra_objects:
    include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl
    library_dirs: /usr/local/openldap-2.3/lib
    libs: ldap_r lber sasl2 ssl crypto
    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found
    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found
    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found
    warning: no files found matching 'Makefile'
    warning: no files found matching 'Modules/LICENSE'
    building '_ldap' extension
    cc -fno-strict-aliasing -DNDEBUG -O2 -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x200000 -fno-strict-aliasing -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.12 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/local/include/python2.4 -c Modules/LDAPObject.c -o build/temp.freebsd-8.1-RELEASE-i386-2.4/Modules/LDAPObject.o
    In file included from Modules/LDAPObject.c:9:
    Modules/errors.h:8:18: error: lber.h: No such file or directory
    Modules/errors.h:9:18: error: ldap.h: No such file or directory
    In file included from Modules/LDAPObject.c:9:
    Modules/errors.h:12: error: expected ')' before '*' token
    In file included from Modules/LDAPObject.c:11:
    Modules/LDAPObject.h:12:2: error: #error Current python-ldap requires OpenLDAP 2.x
    In file included from Modules/LDAPObject.c:11:
    Modules/LDAPObject.h:23: error: expected specifier-qualifier-list before 'LDAP'
    Modules/LDAPObject.h:31: error: expected ')' before '*' token
    In file included from Modules/LDAPObject.c:12:
    Modules/ldapcontrol.h:11: error: expected ')' before '*' token
    Modules/ldapcontrol.h:12: error: expected declaration specifiers or '...' before 'LDAPControl'
    Modules/ldapcontrol.h:13: error: expected ')' before '*' token
    In file included from Modules/LDAPObject.c:13:
    Modules/message.h:11: error: expected ')' before '*' token
    In file included from Modules/LDAPObject.c:14:
    Modules/berval.h:10: warning: 'struct berval' declared inside parameter list
    Modules/berval.h:10: warning: its scope is only this definition or declaration, which is probably not what you want
    Modules/berval.h:12: warning: 'struct berval' declared inside parameter list
    Modules/berval.h:13: warning: 'struct berval' declared inside parameter list
    Modules/LDAPObject.c:18:18: error: sasl.h: No such file or directory
    Modules/LDAPObject.c:26: error: expected ')' before '*' token
    Modules/LDAPObject.c: In function 'dealloc':
    Modules/LDAPObject.c:42: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:43: error: 'LDAPObject' has no member named 'valid'
    Modules/LDAPObject.c:44: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:44: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:45: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:46: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:46: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:47: error: 'LDAPObject' has no member named 'valid'
    Modules/LDAPObject.c:49: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c: In function 'not_valid':
    Modules/LDAPObject.c:65: error: 'LDAPObject' has no member named 'valid'
    Modules/LDAPObject.c: At top level:
    Modules/LDAPObject.c:76: error: expected ')' before '*' token
    Modules/LDAPObject.c:103: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    Modules/LDAPObject.c:194: error: expected ')' before '*' token
    Modules/LDAPObject.c:206: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    Modules/LDAPObject.c: In function 'l_ldap_unbind_ext':
    Modules/LDAPObject.c:332: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:332: error: (Each undeclared identifier is reported only once
    Modules/LDAPObject.c:332: error: for each function it appears in.)
    Modules/LDAPObject.c:332: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:333: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:341: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:346: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:350: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:350: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:351: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:352: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:352: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:357: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:358: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:358: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c:360: error: 'LDAPObject' has no member named 'valid'
    Modules/LDAPObject.c: In function 'l_ldap_abandon_ext':
    Modules/LDAPObject.c:373: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:373: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:374: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:382: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:387: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:391: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:391: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:392: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:393: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:393: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:398: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:399: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:399: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_add_ext':
    Modules/LDAPObject.c:414: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:414: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:415: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:419: error: 'LDAPMod' undeclared (first use in this function)
    Modules/LDAPObject.c:419: error: 'mods' undeclared (first use in this function)
    Modules/LDAPObject.c:429: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:434: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:438: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:438: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:439: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:440: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:440: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:445: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:446: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:446: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_simple_bind':
    Modules/LDAPObject.c:462: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:462: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:463: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:464: error: storage size of 'cred' isn't known
    Modules/LDAPObject.c:467: error: 'ber_len_t' undeclared (first use in this function)
    Modules/LDAPObject.c:467: error: expected ';' before 'cred_len'
    Modules/LDAPObject.c:472: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:477: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:481: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:481: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:482: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:482: error: 'LDAP_SASL_SIMPLE' undeclared (first use in this function)
    Modules/LDAPObject.c:483: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:483: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:488: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:489: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:489: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: At top level:
    Modules/LDAPObject.c:553: error: expected declaration specifiers or '...' before 'sasl_interact_t'
    Modules/LDAPObject.c: In function 'interaction':
    Modules/LDAPObject.c:562: error: 'interact' undeclared (first use in this function)
    Modules/LDAPObject.c:569: error: 'LDAP_OPERATIONS_ERROR' undeclared (first use in this function)
    Modules/LDAPObject.c:589: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c: At top level:
    Modules/LDAPObject.c:601: error: expected ')' before '*' token
    Modules/LDAPObject.c: In function 'l_ldap_sasl_interactive_bind_s':
    Modules/LDAPObject.c:627: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:627: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:628: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:634: error: 'LDAP_SASL_QUIET' undeclared (first use in this function)
    Modules/LDAPObject.c:653: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:658: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:674: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:677: error: expected expression before ')' token
    Modules/LDAPObject.c:686: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:687: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:687: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_compare_ext':
    Modules/LDAPObject.c:745: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:745: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:746: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:751: error: storage size of 'value' isn't known
    Modules/LDAPObject.c:754: error: 'ber_len_t' undeclared (first use in this function)
    Modules/LDAPObject.c:754: error: expected ';' before 'value_len'
    Modules/LDAPObject.c:759: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:764: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:768: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:768: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:769: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:770: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:770: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:775: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:776: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:776: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_delete_ext':
    Modules/LDAPObject.c:790: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:790: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:791: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:800: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:805: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:809: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:809: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:810: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:811: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:811: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:816: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:817: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:817: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_modify_ext':
    Modules/LDAPObject.c:832: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:832: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:833: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:837: error: 'LDAPMod' undeclared (first use in this function)
    Modules/LDAPObject.c:837: error: 'mods' undeclared (first use in this function)
    Modules/LDAPObject.c:847: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:852: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:856: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:856: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:857: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:858: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:858: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:864: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:865: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:865: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_rename':
    Modules/LDAPObject.c:881: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:881: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:882: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:892: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:897: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:901: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:901: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:902: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:903: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:903: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:908: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:909: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:909: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_result3':
    Modules/LDAPObject.c:920: error: 'LDAP_RES_ANY' undeclared (first use in this function)
    Modules/LDAPObject.c:926: error: 'LDAPMessage' undeclared (first use in this function)
    Modules/LDAPObject.c:926: error: 'msg' undeclared (first use in this function)
    Modules/LDAPObject.c:941: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:941: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:942: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:943: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:943: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:946: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:946: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c:953: error: 'LDAP_TIMEOUT' undeclared (first use in this function)
    Modules/LDAPObject.c:961: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:961: error: 'serverctrls' undeclared (first use in this function)
    Modules/LDAPObject.c:962: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:962: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:963: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:965: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:965: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:967: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:969: error: 'LDAP_REFERRAL' undeclared (first use in this function)
    Modules/LDAPObject.c:975: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:975: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c:978: warning: assignment makes pointer from integer without a cast
    Modules/LDAPObject.c:979: error: 'LDAP_NO_MEMORY' undeclared (first use in this function)
    Modules/LDAPObject.c:980: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:980: error: 'LDAP_OPT_ERROR_NUMBER' undeclared (first use in this function)
    Modules/LDAPObject.c:982: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:982: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c:986: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:986: warning: assignment makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_search_ext':
    Modules/LDAPObject.c:1027: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:1027: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:1028: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:1055: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:1060: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:1064: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1064: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1065: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1067: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1067: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1073: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:1074: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1074: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_whoami_s':
    Modules/LDAPObject.c:1087: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:1087: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:1088: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:1099: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:1104: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:1108: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1108: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1109: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1110: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1110: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1115: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:1116: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1116: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c:1118: warning: passing argument 1 of 'LDAPberval_to_object' from incompatible pointer type
    Modules/LDAPObject.c: In function 'l_ldap_start_tls_s':
    Modules/LDAPObject.c:1134: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1135: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:1136: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1136: error: 'LDAP_OPT_ERROR_NUMBER' undeclared (first use in this function)
    Modules/LDAPObject.c:1137: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1137: warning: return makes pointer from integer without a cast
    Modules/LDAPObject.c: In function 'l_ldap_passwd':
    Modules/LDAPObject.c:1181: error: storage size of 'user' isn't known
    Modules/LDAPObject.c:1183: error: storage size of 'oldpw' isn't known
    Modules/LDAPObject.c:1185: error: storage size of 'newpw' isn't known
    Modules/LDAPObject.c:1189: error: 'LDAPControl' undeclared (first use in this function)
    Modules/LDAPObject.c:1189: error: 'server_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:1190: error: 'client_ldcs' undeclared (first use in this function)
    Modules/LDAPObject.c:1198: error: 'ber_len_t' undeclared (first use in this function)
    Modules/LDAPObject.c:1198: error: expected ';' before 'user_len'
    Modules/LDAPObject.c:1199: error: expected ';' before 'oldpw_len'
    Modules/LDAPObject.c:1200: error: expected ';' before 'newpw_len'
    Modules/LDAPObject.c:1205: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:1210: error: too many arguments to function 'LDAPControls_from_object'
    Modules/LDAPObject.c:1214: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1214: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1215: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1222: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1222: error: 'LDAPObject' has no member named '_save'
    Modules/LDAPObject.c:1227: error: 'LDAP_SUCCESS' undeclared (first use in this function)
    Modules/LDAPObject.c:1228: error: 'LDAPObject' has no member named 'ldap'
    Modules/LDAPObject.c:1228: warning: return makes pointer from integer without a cast
    error: command 'cc' failed with exit status 1

The most import lines to take note of here are the following:

include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl
library_dirs: /usr/local/openldap-2.3/lib
Modules/errors.h:8:18: error: lber.h: No such file or directory
Modules/errors.h:9:18: error: ldap.h: No such file or directory
Modules/LDAPObject.c:18:18: error: sasl.h: No such file or directory

This means that when pip was trying to install python-ldap, it could not find the dev headers necessary to build the C extensions. Most of the time, this just means that you need to install the appropriate library-dev package, but in this case, I already have the headers available in /usr/local/include.

The solution in this case is to use zc.recipe.egg to install the python-ldap egg for us. This will allow us to define extra paths to look in for the header files.

[buildout]
parts =
    ...
    python-ldap

[python-ldap]
recipe = zc.recipe.egg:custom
egg = python-ldap
include-dirs =
    /opt/local/include
    /opt/local/include/sasl
    /usr/local/include
    /usr/local/include/sasl
    /usr/include
    /usr/include/sasl
library-dirs =
    /opt/local/lib
    /opt/local/lib/sasl2
    /usr/local/lib
    /usr/local/lib/sasl2
    /usr/lib
    /usr/lib/sasl2
rpath = ${:library-dirs}

Now you can use this egg by referencing the python-ldap part as follows:

[instance]
...
eggs =
    ...
    ${python-ldap:egg}

This allows you to rely on your package manager to keep the LDAP libraries up to date.

Questions? Comments? Feel free to provide your feedback below. We will make sure to respond to you.

 
Posted by chanchal on Oct 03, 2011 05:05 AM
Hi, first of all thanks for an useful information, Sir, i am trying to integrate Ldap authentication in Buildbot. can you please send some more info or an sample i am using -python2.6 -ubuntu -buildbot -python-ldap
Posted by Paulo Graça on Apr 12, 2012 07:36 AM
I accomplish this by usign apt-get install: $ sudo apt-get install python-ldap
Posted by on Aug 27, 2013 07:44 PM
This is one way to do it, but I believe the point of using pip in this case is to install python-ldap in a virtual environment to keep projects contained. Using apt-get would not achieve this.
Posted by Derek on Aug 14, 2012 11:45 PM
hi, i follow your way to setup ldap,but failed [root@mail zeocluster]# ./bin/buildout While: Initializing. Getting section buildout. Initializing section buildout. Getting option buildout:eggs. Getting section python-ldap. Initializing section python-ldap. Installing recipe zc.recipe.egg. Error: There is a version conflict. We already have: zc.buildout 1.4.4 but zc.recipe.egg 1.3.2 requires 'zc.buildout>=1.5.0'.
Posted by Derek on Aug 15, 2012 06:39 AM
[buildout] parts = ... python-ldap [python-ldap] recipe = zc.recipe.egg:custom egg = python-ldap include-dirs = /opt/local/include /opt/local/include/sasl /usr/local/include /usr/local/include/sasl /usr/include /usr/include/sasl library-dirs = /opt/local/lib /opt/local/lib/sasl2 /usr/local/lib /usr/local/lib/sasl2 /usr/lib /usr/lib/sasl2 rpath = ${:library-dirs} how about in centos6.2 library-dirs? the same?
Add comment

You can add a comment by filling out the form below. Plain text formatting.

puzzle

Next Steps


Select a type of support:

Contact our sales team

First name:
Last name:
Email:
Phone Number:
Message:
Fight spam:
What is + ?
 
Call Us 1 866.SIX FEET
Sections