Skip to content

Commit 815daba

Browse files
RyanGlScottphadej
authored andcommitted
Avoid segfaults on Windows when linking against official PostgreSQL distribution
1 parent ff87d13 commit 815daba

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

postgresql-libpq.cabal

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,17 @@ Library
6565
if flag(use-pkg-config)
6666
Pkgconfig-depends: libpq >=9.3
6767
else
68-
Extra-Libraries: pq
69-
if os(openbsd)
70-
Extra-Libraries: crypto ssl
68+
if os(windows)
69+
-- Due to https://sourceware.org/bugzilla/show_bug.cgi?id=22948,
70+
-- if we specify pq instead of libpq, then ld might link against
71+
-- libpq.dll directly, which can lead to segfaults. As a temporary hack,
72+
-- we force ld to link against the libpq.lib import library directly
73+
-- by specifying libpq here.
74+
Extra-Libraries: libpq
75+
else
76+
Extra-Libraries: pq
77+
if os(openbsd)
78+
Extra-Libraries: crypto ssl
7179

7280
-- Other-modules:
7381
Build-tools: hsc2hs

0 commit comments

Comments
 (0)