如何在 Windows 上安装 Haskell LDAP?

How to install Haskell LDAP on Windows?

编辑 通过使用 MSYS2 for OpenLDAP 解决

我正在尝试在 Windows 上安装 https://hackage.haskell.org/package/LDAP

我通过 Cygwin 安装了 OpenLDAP,这些库似乎被引用了,但现在我遇到了这些链接器错误并且不确定缺少什么。谁能解释我做错了什么?如果有某个过程应该有效,我也很乐意开始清理。

运行:

cabal install LDAP --extra-lib-dirs=c:/cygwin64/lib --extra-include-dirs=c:/cygwin64/usr/include

结果:

dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x53): undefined reference to `__ctype_ptr__'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x97): undefined reference to `__ctype_ptr__'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0xd5): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0xf4): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x102): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x114): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x127): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x13c): more undefined references to `_impure_ptr' follow
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x174): undefined reference to `__swbuf_r'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x17d): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x188): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x196): undefined reference to `__swbuf_r'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x1a1): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x1b4): undefined reference to `_impure_ptr'
dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o:Types_hsc_utils.c:(.text+0x201): undefined reference to `_impure_ptr'
c:/program files/haskell platform/7.10.2-a/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o: bad reloc address 0x0 in section `.pdata'
c:/program files/haskell platform/7.10.2-a/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2: ld returned 1 exit status
linking dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_make.o failed (exit code 1)
command was: C:\Program Files\Haskell Platform.10.2-a\mingw\bin\gcc.exe dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_make.o dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_utils.o -o dist\dist-sandbox-8cd1684e\build\LDAP\Types_hsc_make.exe -Lc:/cygwin64/lib -lldap -llber -LC:\Program Files\Haskell Platform.10.2-a\lib\base_GDytRqRVSUX7zckgKqJjgw -lwsock32 -luser32 -lshell32 -LC:\Program Files\Haskell Platform.10.2-a\lib\integ_2aU3IZNMF9a7mQ0OzsZ0dS -LC:\Program Files\Haskell Platform.10.2-a\lib\ghcpr_8TmvWUcS1U1IKHT0levwg3 -LC:\Program Files\Haskell Platform.10.2-a\lib/rts -lm -lwsock32 -lgdi32 -lwinmm
cabal: Error: some packages failed to install:
LDAP-0.6.10 failed during the building phase. The exception was:
ExitFailure 1

/u/wrvn on Reddit directed me to MSYS2.

设置和安装 OpenLDAP 包 (package list) 进行得很顺利,尽管确实花费了特别长的时间。

通过将 C:/msys64/mingw64/bin 目录添加到路径和 运行 cabal install LDAP --extra-lib-dirs=c:/msys64/mingw64/lib --extra-include-dirs=c:/msys64/mingw64/include.

安装的 Haskell LDAP 包

路径当然取决于安装位置和体系结构(mingw32 或 mingw64)。