postgresql-libpq
postgresql-libpq copied to clipboard
Missing entry point libintl_gettext when postgresql-libpq is used from GHCi or Template Haskell on Windows
On Windows 8 (64-bit), PostgreSQL 9.3 (32-bit), GHC 7.6.3 (32-bit), and Cabal 1.18.0.2 (32-bit), I get an error window when I cabal install postgresql-simple:
The procedure entry point libintl_gettext could not be located in the dynamic link library C:\Program Files (x86)\PostgreSQL\9.3\bin\libpq.DLL
I get the same error if I open ghci and run the following:
import Database.PostgreSQL.LibPQ
connectdb undefined
Compiling an executable does not produce this error. Only when it's interpreted (GHCi or Template Haskell) does this error come up.
I suspect GHC's flaky home-made linker is at fault. Hopefully this bug will go away when GHC 7.8 is released (which I hear will have better linker support). In the mean time, maybe there's some workaround that will get the dependencies of libpq.dll to load.
Thanks for the report, but I don't use Windows hardly at all. So I won't be able to offer much real help here.
Although, you might want to read pull request #13; especially the link to a thread on an OpenBSD mailing list regarding this binding. Most interestingly, they suggested that we should be getting link options from pg_config.
It does seem less than likely that this would also fix these windows build problems, but you might find it useful nonetheless. Though I would like to know what the output of your pg_config is.
I'm assuming this test works with older versions of libpq and/or older versions of GHC?
It used to work with older versions of PostgreSQL. Here is my pg_config output:
BINDIR = c:/PROGRA~2/POSTGR~1/9.3/bin
DOCDIR = c:/PROGRA~2/POSTGR~1/9.3/doc
HTMLDIR = c:/PROGRA~2/POSTGR~1/9.3/doc
INCLUDEDIR = c:/PROGRA~2/POSTGR~1/9.3/include
PKGINCLUDEDIR = c:/PROGRA~2/POSTGR~1/9.3/include
INCLUDEDIR-SERVER = c:/PROGRA~2/POSTGR~1/9.3/include/server
LIBDIR = c:/PROGRA~2/POSTGR~1/9.3/lib
PKGLIBDIR = c:/PROGRA~2/POSTGR~1/9.3/lib
LOCALEDIR = c:/PROGRA~2/POSTGR~1/9.3/share/locale
MANDIR = c:/Program Files (x86)/PostgreSQL/9.3/man
SHAREDIR = c:/PROGRA~2/POSTGR~1/9.3/share
SYSCONFDIR = c:/Program Files (x86)/PostgreSQL/9.3/etc
PGXS = c:/Program Files (x86)/PostgreSQL/9.3/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = --enable-thread-safety --enable-integer-datetimes --enable-nls --with-ldap --with-ossp-uuid --with-libxml --with-libxslt --with-tcl --with-perl --with-python
VERSION = PostgreSQL 9.3.2
I did find a workaround: put libintl.dll in the current directory. That is:
- When running ghci from the command line, put libintl.dll in the current directory where ghci was launched.
- When building a package that uses Template Haskell (like postgresql-simple), put libintl in the same directory as the cabal file.
Doing these, I was able to build postgresql-simple and get the test suite to work.
Is libintl a new dependency, introduced with libpq 9.3?