Error trying installing python-ldap on virtualenv

Hi friends!!! Last 4 hours i´d tried to install python-ldap on python3.8 based viertualenv, for django developing purposes…and allways i had same error:

gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fno-semantic-interposition -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.9/Modules/LDAPObject.o build/temp.linux-x86_64-3.9/Modules/berval.o build/temp.linux-x86_64-3.9/Modules/common.o build/temp.linux-x86_64-3.9/Modules/constants.o build/temp.linux-x86_64-3.9/Modules/functions.o build/temp.linux-x86_64-3.9/Modules/ldapcontrol.o build/temp.linux-x86_64-3.9/Modules/ldapmodule.o build/temp.linux-x86_64-3.9/Modules/message.o build/temp.linux-x86_64-3.9/Modules/options.o -L/usr/lib -lldap_r -llber -o build/lib.linux-x86_64-3.9/
  /usr/bin/ld: no se puede encontrar -lldap_r
  collect2: error: ld devolvió el estado de salida 1
  error: command '/usr/bin/gcc' failed with exit code 1
  ERROR: Failed building wheel for python-ldap

Some idea??? Merry Chrystmas!!!

Your problem is because gcc cannot find “libldap_r” library, presumably located in “/usr/lib”.

Check if “libldap_r” exist in “/usr/lib” by ls /usr/lib/libldap_r.*. Either “.so” or “.a” or both should exist.

Just in case, also check for “liblber” by ls /usr/lib/liblber.* since you need both of these libraries.

Also check for these libraries in “/usr/local/lib”. If you can find both here, you need to somehow add this path so that you should see an additional “-L/usr/local/lib” in addition of seeing “-L/usr/lib” in the gcc output above.

If these libraries don’t exist, you need to install it first. Try searching and installing with pacman or pamac.

A tip: Next time you should run export LANG=C first to make sure the current terminal session locale uses english language; some apps like gcc use locale settings.

Hi friend!!! Thanks for your help… those libraries are in /usr/lib


but not in /usr/local/lib…so they are installed but not present in /usr/local. What do i need to do, add a symbolic link to that location???

By the way…ln -s /usr/lib/ /usr/local/lib/ and the same for liblber doesn´t work :pensive:

hey! try installing libldap and openldap with pacman. also make sure you have all packages from the base-devel group

That looks like 3.9.

Otherwise libldap_r was merged into libldap, so you will not find in 2.6.0.

1 Like

Thats right…how the images show i have libldap and liblber—but without _r…And now manjaro have Python 3.9 as Python base…but on my virtualenv i have Python 3.8.11…

I do both things…all packages of base-devel are installed , the same for openldap and libldap…and nothing…But i´d noted that on a virtualenv with the same python of the operative system…that´s virtualenv <virtualenv_name> instead of virtualenv -p <dir_to_compilated_version_of_python>…i’d install python/ldap without problems at all…

This seems an issue in the python-ldap itself, as @wntr mentioned, the current OpenLDAP 2.6.0 library name is libldap; Manjaro uses the latest OpenLDAP library. There seems no longer libldap_r.

Refer to below issues and some current workaround:

Anyway, this is probably no longer a Manjaro issue, more to the python-ldap.

1 Like

Hi!!! Based on your answer …i create a simbolic link from libldap to libldap_r.. into /usr/lib and problem solved…thanks everybody…Merry Chrystmas!!!

Here i was near to the solution but i miss _r…

Note that it seems that libldap_r is the thread-safe version of libldap:

I can’t tell if your solution is safe because I’m not sure if the current libldap has been designed to be tread-safe or not; no such info at the official site.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.