Skip to content

Commit

Permalink
Explicitly link against mingwex on Windows
Browse files Browse the repository at this point in the history
This works around issues like the ones seen in
https://gitlab.haskell.org/ghc/ghc/-/issues/23533 on GHC 9.4.5, 9.6.1, and
9.6.2 on Windows.
  • Loading branch information
RyanGlScott committed Jul 19, 2023
1 parent 9609e9f commit d3b9af1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lmdb/lmdb.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,17 @@ Library
install-includes: lmdb.h midl.h
c-sources: cbits/mdb.c cbits/midl.c

-- GHC 9.4.5, 9.6.1, and 9.6.2 on Windows do not link against mingwex, but
-- lmdb implicitly depends on this library due to its use of _GNU_SOURCE,
-- which implies mingwex on Windows. To avoid linker errors in the absence of
-- a mingwex dependency (see https://gitlab.haskell.org/ghc/ghc/-/issues/23533
-- for an example of this), we depend on mingwex explicitly here.
--
-- Other versions of GHC on Windows already depend on mingwex, so we guard
-- this behind appropriate conditionals.
if os(windows)
if (impl(ghc >= 9.4.5) && !impl(ghc >= 9.4.6)) || (impl(ghc >= 9.6.1) && !impl(ghc >= 9.6.3))
extra-libraries: mingwex

ghc-options: -Wall

0 comments on commit d3b9af1

Please sign in to comment.