0

EDIT Resolved by using MSYS2 for OpenLDAP

I'm trying to install https://hackage.haskell.org/package/LDAP on Windows.

I installed OpenLDAP through Cygwin and those libraries appear to be referenced, but now I'm getting these linker errors and not sure what is missing. Could anyone explain what I'm doing incorrectly? I would also be happy to start clean if there is a certain process that should work.

Running:

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

Results in:

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
ryachza
  • 4,460
  • 18
  • 28

1 Answers1

0

/u/wrvn on Reddit directed me to MSYS2.

Setting that up and installing the OpenLDAP package (package list) went smoothly, though did take an exceptionally long time.

The Haskell LDAP package installed by adding the C:/msys64/mingw64/bin directory to the path and running cabal install LDAP --extra-lib-dirs=c:/msys64/mingw64/lib --extra-include-dirs=c:/msys64/mingw64/include.

Paths of course are dependent on installation location and architecture (mingw32 or mingw64).

ryachza
  • 4,460
  • 18
  • 28