ldapcherry icon indicating copy to clipboard operation
ldapcherry copied to clipboard

pip install ldapcherry - fatal error: lber.h: No such file or directory

Open vishwakumba opened this issue 5 years ago • 4 comments

OS : Centos 7.2 Python : 2.7.5 ldapcherry : 1.1.1

I obtained the foll. error while installing ldapcherry.

$ pip install ldapcherry

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=3.2.0 -DLDAPMODULE_AUTHOR=python-ldap project -DLDAPMODULE_LICENSE=Python style -IModules -I/usr/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o In file included from Modules/LDAPObject.c:8:0: Modules/constants.h:7:18: fatal error: lber.h: No such file or directory #include "lber.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;file='/tmp/pip-build-yVznKq/python-ldap/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-PAw1yB-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-yVznKq/python-ldap/

vishwakumba avatar Apr 30 '19 12:04 vishwakumba

I was able to resolve this issue by the foll. workaround :

$ yum install -y yum-utils
$ yum-builddep -y python-ldap
$ pip install -U python-ldap

vishwakumba avatar Apr 30 '19 12:04 vishwakumba

Actually, it's not a work around, it's the proper way to do it if you are installing the dependencies through pip (python-ldap and python-yaml are bindings to C libraries, these needs to be compiled, so you need the headers and a compiler).

I need to specify if in the documentation.

Also, the ldapcherry dependency are already packaged by CentOS (with Epel) and Debian/Ubuntu, I should probably mention it and document it, it will be less fragile than pip.

kakwa avatar May 03 '19 10:05 kakwa

If you're installing on CentOS and already have pip, then the following should work:

$ sudo yum install python-devel gcc openldap-devel

But it seems that you want three things in the documentation:

  1. Install ldapcherry through pip
  2. Install dependencies through OS package management and install ldapcherry with pip
  3. Install dependencies through OS package management and run setup.py

Would you like this before "From the sources" in install.rst?

smacz42 avatar Jul 16 '19 03:07 smacz42

Yes please - thanks. :)-

vishwakumba avatar Jul 16 '19 09:07 vishwakumba