如何在Windows上安装Haskell LDAP?

时间:2015-08-13 11:55:37

标签: windows haskell openldap

编辑使用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\7.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\7.10.2-a\lib\base_GDytRqRVSUX7zckgKqJjgw -lwsock32 -luser32 -lshell32 -LC:\Program Files\Haskell Platform\7.10.2-a\lib\integ_2aU3IZNMF9a7mQ0OzsZ0dS -LC:\Program Files\Haskell Platform\7.10.2-a\lib\ghcpr_8TmvWUcS1U1IKHT0levwg3 -LC:\Program Files\Haskell Platform\7.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

1 个答案:

答案 0 :(得分:0)

Reddit上的

/u/wrvn指示我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)。