ldap2pg icon indicating copy to clipboard operation
ldap2pg copied to clipboard

Windows support

Open arjan-saly-tfs opened this issue 3 years ago • 6 comments

Hi, All documentation is Linux based. However, we have some PostgreSQL databases running on Windows.

Is it possible to run ldap2pg on a windows environment?

Thanks! Arjan

Tasks

  • [ ] Add a CI job/Workflow for Windows
  • [ ] Document Windows installation

arjan-saly-tfs avatar May 23 '22 09:05 arjan-saly-tfs

Hi @arjan-saly-tfs thanks for your feedbacks.

I don't have experience of running ldap2pg on Windows. Note that ldap2pg does not requires to run on the same host as PostgreSQL.

ldap2pg has few dependencies. It worth to give it a try using pip. I welcome feedbacks on this.

bersace avatar May 23 '22 09:05 bersace

Giving it a try and followed these steps:

  • Install latest version of Python (3.10.4)
  • On the Windows command prompt I enter "pip install ldap2pg psycopg2-binary" (Skipping the Apt install of ldap/sasl libraries)
  • During install, pip installs dependent package python-ldap
  • During build it fails because it needs "Microsoft C++ Build Tools", including a link to a Microsoft page where I can download them
  • Download & Install these build tools. This installation provides with a lot of ptions to install, I only install these: -- Desktop development with c++ -- .NET desktop build tools -- Universal Windows Platform build tools (Other options target mobile, web, Azure, Office/Sharepoint, DataStorage/SQLServer and Node.js build tools)
  • Restart after installation on advice of the installer
  • Rerun "pip install ldap2pg psycopg2-binary"

Unfortunately the build of python-ldap fails again, with this error: LDAPObject.c C:\<Path>\pip-install-vxkwjx6n\python-ldap_b177a7ef342546a18d5143b58be91df7\Modules\common.h(15): fatal error C1083: Cannot open include file: 'lber.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for python-ldap Failed to build python-ldap

The build also gave this deprecation warning of which I'm not sure if it is relevant: pip-build-env-zrljl0y6\overlay\Lib\site-packages\setuptools\config\setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.

Any ideas how to come around this?

note: Please understand I'm a database specialist/database developer, not an application developer. Installing and interpreting errors I can do, but this is out of my league....

Thanks for helping out here!

arjan-saly-tfs avatar May 23 '22 11:05 arjan-saly-tfs

The build also gave this deprecation warning of which I'm not sure if it is relevant: pip-build-env-zrljl0y6\overlay\Lib\site-packages\setuptools\config\setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.

Any ideas how to come around this?

Yes, you need libldap-dev and libsasl-dev equivalent for Windows. ldap2pg uses OpenLDAP project which should run on Windows.

bersace avatar May 23 '22 12:05 bersace

Hmm, the way I understand the various information on the web, python-ldap actually is a replacement for libldap-dev, However, even there windows support is limited "Unofficial packages for Windows". (Or do I misunderstand?)

It starts to look to me like it can be done, but it'll take too much effort (already). I'll leave it for what it is. Spinning up a Linux environment for this is probably easer and provides more stability.

Thanks for your help!

arjan-saly-tfs avatar May 23 '22 13:05 arjan-saly-tfs

Hmm, the way I understand the various information on the web, python-ldap actually is a replacement for libldap-dev, However, even there windows support is limited "Unofficial packages for Windows". (Or do I misunderstand?)

python-ldap is the official OpenLDAP binding. It's a C Extension requiring compiling with openldap development files.

You'll find pre-built binaries by following https://www.python-ldap.org/en/python-ldap-3.3.0/installing.html

It starts to look to me like it can be done, but it'll take too much effort (already). I'll leave it for what it is. Spinning up a Linux environment for this is probably easer and provides more stability.

Yes, that's fair. If someone wants to contribute a CI job to executes tests on windows and improve documentation, that would be good. Updating title.

bersace avatar May 23 '22 13:05 bersace

Hi @arjan-saly-tfs . ldap2pg 6.0 is now a Go project and ships a windows binary. Could you test it ?

https://github.com/dalibo/ldap2pg/releases/tag/v6.0

bersace avatar Sep 01 '23 06:09 bersace