[python-ldap] Installation on FreeBSD via pypi

Roman Bogorodskiy bogorodskiy at gmail.com
Sat Jun 20 19:26:29 CEST 2015


Hi,

Installation through pip doesn't work out of the box, e.g. running

pip install python-ldap

fails with:

    creating build/temp.freebsd-11.0-CURRENT-amd64-2.7/Modules
    cc -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DNDEBUG -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.19 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/usr/include -I/usr/local/include/python2.7 -c Modules/LDAPObject.c -o build/temp.freebsd-11.0-CURRENT-amd64-2.7/Modules/LDAPObject.o
    In file included from Modules/LDAPObject.c:9:
    Modules/errors.h:8:10: fatal error: 'lber.h' file not found
    #include "lber.h"
             ^
    1 error generated.
    error: command 'cc' failed with exit status 1

This happens because openldap-client installed from FreeBSD ports installs headers
into /usr/local/include and libs into /usr/local/lib, however, these are
not listed in compiler flags.

FreeBSD port deals with that by replacing variables in setup.cfg:

https://svnweb.freebsd.org/ports/head/net/py-ldap/Makefile?revision=390060&view=markup#l23

However, using port is not always convenient, esp. for working with
projects that use virtualenv + pip to manage dependencies (or tox on top
of that). For such cases it's very valuable to be make things work out
of the box from pypi.

Could it be fixed to work straight out from pypi? The obvious fix would
be to just modify setup.cfg to add /usr/local/include to 'include_dirs'
and /usr/local/lib to 'library_dirs'. Also, /usr/local/include/sasl
would be needed I guess.

This will make it work on default FreeBSD installations (i.e. for users
that use FreeBSD ports or packages) and should not break things on other
systems.

Other possible way would be to set OS specific options dynamically in
setup.py but I'm not sure it's worth an effort.

What do you think about that?

PS By the way. http://python-ldap.org/download.shtml This page mentions
FreeBSD port. FreeBSD ports system moved from CVS to SVN few years ago,
so it'd be good to s/CVS/SVN/ here. Also, the port was renamed recently
from 'py-ldap2' to 'py-ldap'. THe proper now is:
https://svnweb.freebsd.org/ports/head/net/py-ldap/

Thanks

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20150620/b7fddbcd/attachment.sig>


More information about the python-ldap mailing list