<#20161 Specify shared object library version duri...
# github-notifications
c
#20161 Specify shared object library version during pex packaging Issue created by alobstedt Is your feature request related to a problem? Please describe. We use the python-ldap extension to connect to Ldap for Authorization. Python-ldap requires the libldap shared library. The .pex is built on a CI/CD Platform which currently has systemwide under
/usr/lib64
the
libldap-2.4.so.2
library. Pantsbuild builds the wheel correctly for the host platform with a dependency to libldap v2.4.2. Now is the issue that the Service Hosts where we deploy the .pex file to are too new to use libldap v2.4.2 and instead only offers v2.5.0. We've installed the v2.5.0 version on the CI/CD Platform but it gets installed under
/usr/local/openldap/lib64/
instead of /usr/lib because there are no official v2.5.0 packages for Oracle Linux 8. Describe the solution you'd like I've looked in the documentation for Third-Party dependencies, Building distributions and the
package
command but couldn't something regarding shared libraries. Q: Is there a way to specify the required shared object library version in pants for a dependency/wheel? I'd like to request that we can specify a path that pants looks in for building the wheels Describe alternatives you've considered The current workaround I'm using is that I'm grabbing an unsupported libldap v2.4.2 from another host and added it to my ansible deployment but this isn't a suitable longterm solution as those libs aren't intended for the OS version. Additional context Error Message during startup:
Copy code
File ".../.pex/venvs/0b481b487b6496fae9665d9331682ced3214bd4c/779eb2cc0ca9e2fdd204774cbc41848e4e7c5055/lib/python3.11/site-packages/ldap/__init__.py", line 34, in <module>
    import _ldap
ImportError: libldap-2.4.so.2: cannot open shared object file: No such file or directory
Shared object file built by pants:
Copy code
user@host:~/.pex/installed_wheels/bb958037e071963a910511e61c469310beb3a85b2293d169b846e81c00178275/python_ldap-3.4.3-cp311-cp311-linux_x86_64.whl$ readelf -d _ldap.cpython-311-x86_64-linux-gnu.so

Dynamic section at offset 0x108f8 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libldap-2.4.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [liblber-2.4.so.2]
The python-ldap library tries to use the above mentioned .so file which requires libldap-2.4.so.2 as a shared library which isn't natively on the hosts and right now only works because I manually move the shared library from another host. Maybe there is already something that can help us out in pants? pantsbuild/pants