
On Tue, Oct 15, 2019 at 03:47:46AM -0400, Viktor Dukhovni wrote:
What I've tried:
2. Build a separate internal library (supported in Cabal 2.0 and later), which is a dependency of the main library and links in the C glue code, but this proved to be a significant rabbit hole...
Following up on my own post, for the record I should note that in fact the second approach work out with GHC 8.[468].x and Cabal 2.x through the magic of .ghc.environment.* files. With Cabal 3.0, these are no longer written by default, but it suffices to create a cabal.project file containing just: packages: . write-ghc-environment-files: always The crux of my issue seems to be that this does not work with older GHC releases (e.g. 8.0.2 and 8.2.2) and perhaps the flag was not set by the Cabal used in AppVeyor on Windows or some other nit got in the way. I now have doctests compiling and running with GHC 8.[468] on Linux and so far just 8.6.5 on Windows. The custom C-code dependency was, as hoped for, satisfied by the addition of the internal library package to the doctest command arguments, I only had to hardcode the format of the "inplace" package-id. https://github.com/kazu-yamamoto/dns/blob/master/test2/doctests.hs Sadly, on Windows the doctests mostly end up hanging and timing out after an hour, but that's a separate issue, perhaps https://gitlab.haskell.org/ghc/ghc/issues/16917 -- Viktor.