Seeking Help: Building Minimal 32-bit Pandoc DLL (Rtf2MD/MD2Rtf Only)

Hi,

I’m attempting to build a minimal 32-bit Pandoc DLL (targeting VB6 integration) with only two core functions:
Rtf2MD (RTF → Markdown)
MD2Rtf (Markdown → RTF)

The core logic is just ~30 LOC (attached), but I’m hitting persistent 32-bit compilation issues. Would anyone still maintaining a 32-bit toolchain be willing to help verify if this can still be built successfully?

Key Requirements:
Static linking to minimize DLL size (original Pandoc CLI is prohibitively large)
i386 architecture for VB6 compatibility
Please avoid UPX compression (to prevent false virus detection in enterprise environments)

My Environment (Failing):

  • GHC 8.6.5 (last official 32-bit Windows build)
  • LTS-14.6
  • Pandoc 2.10.1

Observations:

  1. Fails with commitAndReleaseBuffer: invalid argument (cannot encode character ‘\8226’)
  2. Suspect dependency conflicts in modern Pandoc’s extensive tree

Questions:

  1. Is 32-bit Pandoc DLL compilation still feasible today?
  2. Would anyone with a working i386 environment be willing to:
    Attempt a build with static linking?
    Share the uncompressed binary via Dropbox/Google Drive if successful?

I’ve attached:
[MiniPandoc.hs] (core logic)
[stack.yaml] (dependency config)

Any guidance would be immensely appreciated! I’m happy to provide additional details.

# MiniPandoc.hs
{-# LANGUAGE UnicodeSyntax #-}
{-# OPTIONS_GHC -fbyte-code -fno-warn-unused-do-bind #-}
{-# OPTIONS_GHC -fencoding=UTF-8 #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module MiniPandoc where

import Foreign.C.String
import qualified Data.Text as T
import Text.Pandoc (readMarkdown, writeMarkdown, def)
import Text.Pandoc.Readers.RTF (readRTF)
import Text.Pandoc.Writers.RTF (writeRTF)

-- RTF2Markdown
foreign export ccall rtf2md :: CString -> IO CString
rtf2md :: CString -> IO CString
rtf2md rtf = do
  content <- peekCString rtf
  let result = case readRTF (T.pack content) of
                 Left err -> "RTF parse error: " ++ show err
                 Right doc -> T.unpack $ writeMarkdown def doc
  newCString result

-- Markdown2RTF
foreign export ccall md2rtf :: CString -> IO CString
md2rtf :: CString -> IO CString
md2rtf md = do
  content <- peekCString md
  let result = case readMarkdown def (T.pack content) of
                 Left err -> "Markdown parse error: " ++ show err
                 Right doc -> T.unpack $ writeRTF def doc
  newCString result


# stack.yaml
resolver: lts-14.6
compiler: ghc-8.6.5
compiler-check: match-exact
system-ghc: true
install-ghc: false
arch: i386

packages:
- .

build:
  haddock: false

extra-deps:
  - pandoc-2.10.1
  - pandoc-types-1.22
  - HsYAML-0.2.1.0
  - text-1.2.5.0
  - network-2.6.3.6
  - commonmark-0.1.1.4
  - commonmark-extensions-0.2.6
  - commonmark-pandoc-0.2.3
  - doclayout-0.3.1.1
  - emojis-0.1.4.1
  - jira-wiki-markup-1.3.5
  - aeson-1.4.4.0
  - time-1.9.3
  - directory-1.3.9.0
  - process-1.6.26.1
  - file-io-0.1.5

flags:
  pandoc:
    embed_data_files: false
    trypandoc: false
    static: true
  aeson:
    cffi: false

allow-newer: true

ghc-options:
  "$locals": "-O1 -static -split-sections -optl-s -optl--gc-sections -optl-m32"


# package.yaml
name: MiniPandoc
version: 1.0.0
library:
  source-dirs: src
  dependencies:
    - base >=4.12 && <4.16
    - text ==1.2.5.0
    - bytestring ==0.10.12.0
    - pandoc ==2.10.1
    - pandoc-types ==1.22
    - HsYAML ==0.2.1.0

  ghc-options:
    - -O1
    - -static
    - -split-sections
    - -optl-s
    - -optl--gc-sections
    - -fhide-source-paths
    - -Wno-unused-imports

  extra-libraries:
    - Kernel32
    - shlwapi

This one is simple: GHC emits a Unicode symbol, but your terminal is not Unicode-aware. Happens all the time on Windows. You can either chcp 65001 or set GHC_NO_UNICODE.

2 Likes

Thank you so much for the suggestion! Unfortunately, it hasn’t resolved the issue yet. I’m now encountering a new compilation error:

Warning: Ignoring MiniPandoc's bounds on pandoc-types (==1.22) and using pandoc-types-1.17.6.1.
         Reason: allow-newer enabled.

Warning: No packages found in snapshot which provide a "unzip" executable, which is a build-tool dependency of
         zip-archive

Warning: Ignoring pandoc's bounds on texmath (>=0.12.0.2 && <0.13) and using texmath-0.11.2.2.
         Reason: allow-newer enabled.

Warning: Ignoring skylighting-core's bounds on regex-pcre-builtin (>=0.95) and using regex-pcre-builtin-0.94.4.8.8.35.
         Reason: allow-newer enabled.

Warning: Ignoring pandoc's bounds on pandoc-types (>=1.21 && <1.22) and using pandoc-types-1.17.6.1.
         Reason: allow-newer enabled.

Warning: Ignoring emojis's bounds on base (>=4.13 && <5) and using base-4.12.0.0.
         Reason: allow-newer enabled.

Warning: Ignoring commonmark-pandoc's bounds on pandoc-types (>=1.21 && <1.24) and using pandoc-types-1.17.6.1.
         Reason: allow-newer enabled.

Warning: Ignoring commonmark-extensions's bounds on commonmark (>=0.2.4.1 && <0.3) and using commonmark-0.1.1.4.
         Reason: allow-newer enabled.

Warning: Ignoring commonmark-pandoc's bounds on commonmark (>=0.2.4.1 && <0.3) and using commonmark-0.1.1.4.
         Reason: allow-newer enabled.
SHA                              > using precompiled package
base-compat                      > using precompiled package
base-orphans                     > using precompiled package
base16-bytestring                > using precompiled package
base64-bytestring                > using precompiled package
basement                         > using precompiled package
bitarray                         > using precompiled package
blaze-builder                    > using precompiled package
cereal                           > using precompiled package
cmdargs                          > using precompiled package
colour                           > using precompiled package
data-default-class               > using precompiled package
dlist                            > using precompiled package
emojis                           > using precompiled package
foundation                       > using precompiled package
blaze-markup                     > using precompiled package
hashable                         > using precompiled package
hourglass                        > using precompiled package
hxt-charproperties               > using precompiled package
cookie                           > using precompiled package
Progress 13/107: blaze-markup, cookie, data-default-instances-containers, emojis, foundation, hashable, hourglass, hxt- data-default-instances-containers> using precompiled package
Progress 13/107: blaze-markup, cookie, data-default-instances-containers, emojis, foundation, hashable, hourglass, hxt- Progress 14/107: blaze-markup, cookie, data-default-instances-containers, data-default-instances-dlist, foundation, has data-default-instances-dlist     > using precompiled package
Progress 14/107: blaze-markup, cookie, data-default-instances-containers, data-default-instances-dlist, foundation, has integer-logarithms               > using precompiled package
Progress 14/107: blaze-markup, cookie, data-default-instances-containers, data-default-instances-dlist, foundation, has Progress 15/107: blaze-markup, cookie, data-default-instances-containers, data-default-instances-dlist, hashable, hourg Progress 16/107: blaze-html, cookie, data-default-instances-containers, data-default-instances-dlist, hashable, hourgla blaze-html                       > using precompiled package
Progress 16/107: blaze-html, cookie, data-default-instances-containers, data-default-instances-dlist, hashable, hourgla Progress 17/107: blaze-html, cookie, data-default-instances-containers, data-default-instances-dlist, hourglass, hxt-ch async                            > using precompiled package
Progress 17/107: blaze-html, cookie, data-default-instances-containers, data-default-instances-dlist, hourglass, hxt-ch Progress 18/107: async, blaze-html, case-insensitive, cookie, data-default-instances-containers, data-default-instances case-insensitive                 > using precompiled package
Progress 18/107: async, blaze-html, case-insensitive, cookie, data-default-instances-containers, data-default-instances Progress 19/107: async, blaze-html, case-insensitive, cookie, data-default-instances-containers, data-default-instances hxt-unicode                      > using precompiled package
Progress 19/107: async, blaze-html, case-insensitive, cookie, data-default-instances-containers, data-default-instances Progress 20/107: async, blaze-html, case-insensitive, data-default-instances-containers, data-default-instances-dlist,  memory                           > using precompiled package
Progress 20/107: async, blaze-html, case-insensitive, data-default-instances-containers, data-default-instances-dlist,  Progress 21/107: async, blaze-html, case-insensitive, data-default-instances-dlist, hxt-unicode, integer-logarithms, me mime-types                       > using precompiled package
Progress 21/107: async, blaze-html, case-insensitive, data-default-instances-dlist, hxt-unicode, integer-logarithms, me mintty                           > using precompiled package
network                          > configure
old-locale                       > using precompiled package
network                          > [1 of 2] Compiling Main             ( C:\\Users\james\AppData\Local\Temp\stack-7a47d278738dcf6e\network-2.8.0.1\Setup.hs, C:\\Users\james\AppData\Local\Temp\stack-7a47d278738dcf6e\network-2.8.0.1\.stack-work\dist\cb766d2c\setup\Main.o )
parsec                           > using precompiled package
network                          > [2 of 2] Compiling StackSetupShim   ( C:\\sr\setup-exe-src\setup-shim-O_vy6YIf.hs, C:\\Users\james\AppData\Local\Temp\stack-7a47d278738dcf6e\network-2.8.0.1\.stack-work\dist\cb766d2c\setup\StackSetupShim.o )
http-types                       > using precompiled package
network                          > Linking C:\\Users\\james\\AppData\\Local\\Temp\\stack-7a47d278738dcf6e\\network-2.8.0.1\\.stack-work\\dist\\cb766d2c\\setup\\setup.exe ...
primitive                        > using precompiled package
asn1-types                       > using precompiled package
cryptonite                       > using precompiled package
ansi-terminal                    > using precompiled package
Progress 31/107: ansi-terminal, asn1-types, cryptonite, data-default-instances-old-locale, http-types, network, parsec, data-default-instances-old-locale> using precompiled package
Progress 31/107: ansi-terminal, asn1-types, cryptonite, data-default-instances-old-locale, http-types, network, parsec, Progress 32/107: HsYAML, ansi-terminal, asn1-types, cryptonite, data-default-instances-old-locale, http-types, network, HsYAML                           > using precompiled package
Progress 32/107: HsYAML, ansi-terminal, asn1-types, cryptonite, data-default-instances-old-locale, http-types, network, Progress 33/107: HsYAML, ansi-terminal, asn1-types, commonmark, cryptonite, data-default-instances-old-locale, network, commonmark                       > configure
Progress 33/107: HsYAML, ansi-terminal, asn1-types, commonmark, cryptonite, data-default-instances-old-locale, network, Progress 34/107: HsYAML, ansi-terminal, asn1-types, commonmark, cryptonite, data-default-instances-old-locale, haddock- haddock-library                  > configure
Progress 34/107: HsYAML, ansi-terminal, asn1-types, commonmark, cryptonite, data-default-instances-old-locale, haddock- Progress 35/107: HsYAML, ansi-terminal, asn1-encoding, commonmark, cryptonite, data-default-instances-old-locale, haddo asn1-encoding                    > using precompiled package
Progress 35/107: HsYAML, ansi-terminal, asn1-encoding, commonmark, cryptonite, data-default-instances-old-locale, haddo Progress 36/107: HsYAML, ansi-terminal, asn1-encoding, commonmark, data-default-instances-old-locale, haddock-library,  hxt-regex-xmlschema              > using precompiled package
Progress 36/107: HsYAML, ansi-terminal, asn1-encoding, commonmark, data-default-instances-old-locale, haddock-library,  haddock-library                  > Configuring haddock-library-1.9.0...
Progress 36/107: HsYAML, ansi-terminal, asn1-encoding, commonmark, data-default-instances-old-locale, haddock-library,  commonmark                       > Configuring commonmark-0.1.1.4...
Progress 36/107: HsYAML, ansi-terminal, asn1-encoding, commonmark, data-default-instances-old-locale, haddock-library,  Progress 37/107: HsYAML, asn1-encoding, commonmark, data-default-instances-old-locale, haddock-library, hxt-regex-xmlsc jira-wiki-markup                 > configure
Progress 37/107: HsYAML, asn1-encoding, commonmark, data-default-instances-old-locale, haddock-library, hxt-regex-xmlsc Progress 38/107: HsYAML, asn1-encoding, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-marku data-default                     > using precompiled package
Progress 38/107: HsYAML, asn1-encoding, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-marku Progress 39/107: asn1-encoding, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-markup, netwo network-uri                      > using precompiled package
Progress 39/107: asn1-encoding, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-markup, netwo network                          > Configuring network-2.8.0.1...
Progress 39/107: asn1-encoding, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-markup, netwo Progress 40/107: asn1-parse, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-markup, network, asn1-parse                       > using precompiled package
Progress 40/107: asn1-parse, commonmark, data-default, haddock-library, hxt-regex-xmlschema, jira-wiki-markup, network, pem                              > using precompiled package
haddock-library                  > build with ghc-8.6.5
jira-wiki-markup                 > Configuring jira-wiki-markup-1.3.5...
commonmark                       > build with ghc-8.6.5
haddock-library                  > Preprocessing library for haddock-library-1.9.0..
haddock-library                  > Building library for haddock-library-1.9.0..
random                           > using precompiled package
commonmark                       > Preprocessing library for commonmark-0.1.1.4..
commonmark                       > Building library for commonmark-0.1.1.4..
hxt                              > using precompiled package
haddock-library                  > [1 of 8] Compiling CompatPrelude
regex-base                       > using precompiled package
haddock-library                  > [2 of 8] Compiling Documentation.Haddock.Types
safe                             > using precompiled package
scientific                       > using precompiled package
jira-wiki-markup                 > build with ghc-8.6.5
jira-wiki-markup                 > Preprocessing library for jira-wiki-markup-1.3.5..
jira-wiki-markup                 > Building library for jira-wiki-markup-1.3.5..
split                            > using precompiled package
commonmark                       > [ 1 of 13] Compiling Commonmark.Tokens
jira-wiki-markup                 > [1 of 8] Compiling Text.Jira.Markup
regex-pcre-builtin               > using precompiled package
haddock-library                  > [3 of 8] Compiling Documentation.Haddock.Parser.Monad
commonmark                       > [ 2 of 13] Compiling Commonmark.TokParsers
Progress 49/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, scientific, spl doclayout                        > configure
Progress 49/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, scientific, spl haddock-library                  > [4 of 8] Compiling Documentation.Haddock.Parser.Util
Progress 49/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, scientific, spl Progress 50/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl attoparsec                       > using precompiled package
Progress 50/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl haddock-library                  > [5 of 8] Compiling Documentation.Haddock.Parser.Identifier
Progress 50/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl jira-wiki-markup                 > [2 of 8] Compiling Text.Jira.Parser.Core
Progress 50/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl Progress 51/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl splitmix                         > using precompiled package
Progress 51/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl commonmark                       > [ 3 of 13] Compiling Commonmark.Tag
Progress 51/107: attoparsec, commonmark, doclayout, haddock-library, jira-wiki-markup, network, regex-pcre-builtin, spl syb                              > using precompiled package
haddock-library                  > [6 of 8] Compiling Documentation.Haddock.Markup
jira-wiki-markup                 > [3 of 8] Compiling Text.Jira.Parser.Shared
haddock-library                  > [7 of 8] Compiling Documentation.Haddock.Doc
doclayout                        > Configuring doclayout-0.3.1.1...
tagged                           > using precompiled package
jira-wiki-markup                 > [4 of 8] Compiling Text.Jira.Parser.Inline
haddock-library                  > [8 of 8] Compiling Documentation.Haddock.Parser
QuickCheck                       > using precompiled package
network                          > configure: WARNING: unrecognized options: --with-compiler
tagsoup                          > using precompiled package
th-abstraction                   > using precompiled package
jira-wiki-markup                 > [5 of 8] Compiling Text.Jira.Parser.PlainText
doclayout                        > build with ghc-8.6.5
time-compat                      > using precompiled package
jira-wiki-markup                 > [6 of 8] Compiling Text.Jira.Parser.Block
doclayout                        > Preprocessing library for doclayout-0.3.1.1..
commonmark                       > [ 4 of 13] Compiling Commonmark.Entity
doclayout                        > Building library for doclayout-0.3.1.1..
Progress 58/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, th-abstraction, time-compat, transf transformers-compat              > using precompiled package
Progress 58/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, th-abstraction, time-compat, transf doclayout                        > [1 of 1] Compiling Text.DocLayout
Progress 58/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, th-abstraction, time-compat, transf Progress 59/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, time-compat, transformers-compat, u unicode-transforms               > using precompiled package
Progress 59/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, time-compat, transformers-compat, u jira-wiki-markup                 > [7 of 8] Compiling Text.Jira.Parser
Progress 59/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, time-compat, transformers-compat, u Progress 60/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, transformers-compat, unicode-transf unordered-containers             > using precompiled package
Progress 60/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, transformers-compat, unicode-transf jira-wiki-markup                 > [8 of 8] Compiling Text.Jira.Printer
Progress 60/107: commonmark, doclayout, haddock-library, jira-wiki-markup, network, transformers-compat, unicode-transf Progress 61/107: Glob, commonmark, doclayout, haddock-library, jira-wiki-markup, network, unicode-transforms, unordered Glob                             > using precompiled package
Progress 61/107: Glob, commonmark, doclayout, haddock-library, jira-wiki-markup, network, unicode-transforms, unordered Progress 62/107: Glob, commonmark, doclayout, exceptions, haddock-library, jira-wiki-markup, network, unordered-contain exceptions                       > using precompiled package
Progress 62/107: Glob, commonmark, doclayout, exceptions, haddock-library, jira-wiki-markup, network, unordered-contain utf8-string                      > using precompiled package
haddock-library                  > copy/register
uuid-types                       > using precompiled package
haddock-library                  > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\haddock-library-1.9.0-9MTNBaRvUgW9gL30He8Lcr
network                          > configure: loading site script /usr/local/etc/config.site
commonmark                       > [ 5 of 13] Compiling Commonmark.Types
haddock-library                  > Registering library for haddock-library-1.9.0..
vector                           > using precompiled package
errors                           > configure
commonmark                       > [ 6 of 13] Compiling Commonmark.SourceMap
jira-wiki-markup                 > Preprocessing executable 'jira-wiki-markup' for jira-wiki-markup-1.3.5..
doclayout                        > copy/register
jira-wiki-markup                 > Building executable 'jira-wiki-markup' for jira-wiki-markup-1.3.5..
doclayout                        > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\doclayout-0.3.1.1-5nr61HolGYgAdNuz04kw91
jira-wiki-markup                 > [1 of 1] Compiling Main
hslua                            > configure
network                          > checking build system type... i686-w64-mingw32
network                          > checking host system type... i686-w64-mingw32
network                          > checking for gcc... C:\Users\james\AppData\Local\Programs\stack\I386-W~1\GHC-86~1.5\lib\../mingw/bin\gcc.exe
commonmark                       > [ 7 of 13] Compiling Commonmark.ReferenceMap
doclayout                        > Registering library for doclayout-0.3.1.1..
temporary                        > using precompiled package
jira-wiki-markup                 > Linking .stack-work\\dist\\cb766d2c\\build\\jira-wiki-markup\\jira-wiki-markup.exe ...
commonmark                       > [ 8 of 13] Compiling Commonmark.Inlines
x509                             > using precompiled package
errors                           > Configuring errors-2.3.0...
hslua                            > Configuring hslua-1.1.2...
xml                              > using precompiled package
x509-store                       > using precompiled package
aeson                            > configure
zlib                             > using precompiled package
errors                           > build with ghc-8.6.5
errors                           > Preprocessing library for errors-2.3.0..
errors                           > Building library for errors-2.3.0..
x509-system                      > using precompiled package
hslua                            > build with ghc-8.6.5
jira-wiki-markup                 > copy/register
JuicyPixels                      > using precompiled package
hslua                            > Preprocessing library for hslua-1.1.2..
jira-wiki-markup                 > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\jira-wiki-markup-1.3.5-3Ju2QESleeX1cDAfDZMtox
jira-wiki-markup                 > Installing executable jira-wiki-markup in C:\sr\snapshots\bbfe763e\bin
errors                           > [1 of 5] Compiling Control.Error.Util
network                          > checking whether the C compiler works... no
network                          > configure: error: in `/c/Users/james/AppData/Local/Temp/stack-7a47d278738dcf6e/network-2.8.0.1/.stack-work/dist/cb766d2c/build':
network                          > configure: error: C compiler cannot create executables
network                          > See `config.log' for more details
aeson                            > Configuring aeson-1.4.5.0...
errors                           > [2 of 5] Compiling Control.Error.Safe
errors                           > [3 of 5] Compiling Data.EitherR
commonmark                       > [ 9 of 13] Compiling Commonmark.Html
jira-wiki-markup                 > Registering library for jira-wiki-markup-1.3.5..
errors                           > [4 of 5] Compiling Control.Error.Script
errors                           > [5 of 5] Compiling Control.Error
commonmark                       > [10 of 13] Compiling Commonmark.Blocks
aeson                            > build with ghc-8.6.5
errors                           > copy/register
errors                           > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\errors-2.3.0-BPjcYGuODJC6ztzdo6YUrG
aeson                            > Preprocessing library for aeson-1.4.5.0..
aeson                            > Building library for aeson-1.4.5.0..
errors                           > Registering library for errors-2.3.0..
aeson                            > [ 1 of 25] Compiling Data.Aeson.Compat
aeson                            > [ 2 of 25] Compiling Data.Aeson.Internal.Functions
aeson                            > [ 3 of 25] Compiling Data.Aeson.Parser.UnescapePure
aeson                            > [ 4 of 25] Compiling Data.Aeson.Parser.Unescape
hslua                            > Building library for hslua-1.1.2..
aeson                            > [ 5 of 25] Compiling Data.Aeson.Types.Generic
aeson                            > [ 6 of 25] Compiling Data.Aeson.Types.Internal
hslua                            > [ 1 of 19] Compiling Prelude
commonmark                       > [11 of 13] Compiling Commonmark.Syntax
aeson                            > [ 7 of 25] Compiling Data.Aeson.Parser.Internal
commonmark                       > [12 of 13] Compiling Commonmark.Parser
hslua                            > [ 2 of 19] Compiling Foreign.Lua.Utf8
commonmark                       > [13 of 13] Compiling Commonmark
hslua                            > [ 3 of 19] Compiling Foreign.Lua.Core.Types
commonmark                       > copy/register
commonmark                       > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\commonmark-0.1.1.4-1GRFdQCdZOnFosr4kI9te5
hslua                            > [ 4 of 19] Compiling Foreign.Lua.Core.Error
commonmark                       > Registering library for commonmark-0.1.1.4..
hslua                            > [ 5 of 19] Compiling Foreign.Lua.Core.RawBindings
hslua                            > [ 6 of 19] Compiling Foreign.Lua.Core.Constants
hslua                            > [ 7 of 19] Compiling Foreign.Lua.Core.Functions
hslua                            > [ 8 of 19] Compiling Foreign.Lua.Core.Auxiliary
hslua                            > [ 9 of 19] Compiling Foreign.Lua.Core
hslua                            > [10 of 19] Compiling Foreign.Lua.Push
hslua                            > [11 of 19] Compiling Foreign.Lua.Types.Pushable
aeson                            > [ 8 of 25] Compiling Data.Aeson.Parser
hslua                            > [12 of 19] Compiling Foreign.Lua.Peek
aeson                            > [ 9 of 25] Compiling Data.Attoparsec.Time.Internal
aeson                            >
aeson                            > attoparsec-iso8601\Data\Attoparsec\Time\Internal.hs:24:1: warning: [-Wunused-imports]
aeson                            >     The import of ‘Unsafe.Coerce’ is redundant
aeson                            >       except perhaps to import instances from ‘Unsafe.Coerce’
aeson                            >     To import instances alone, use: import Unsafe.Coerce()
aeson                            >    |
aeson                            > 24 | import Unsafe.Coerce (unsafeCoerce)
aeson                            >    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
aeson                            > [10 of 25] Compiling Data.Attoparsec.Time
hslua                            > [13 of 19] Compiling Foreign.Lua.Types.Peekable
hslua                            > [14 of 19] Compiling Foreign.Lua.Userdata
aeson                            > [11 of 25] Compiling Data.Aeson.Parser.Time
aeson                            > [12 of 25] Compiling Data.Aeson.Types.FromJSON
hslua                            > [15 of 19] Compiling Foreign.Lua.Types
hslua                            > [16 of 19] Compiling Foreign.Lua.Util
aeson                            >
aeson                            > Data\Aeson\Types\FromJSON.hs:505:3: warning: [-Winline-rule-shadowing]
aeson                            >     Rule "FromJSONKeyCoerce: fmap id" may never fire
aeson                            >       because ‘id’ might inline first
aeson                            >     Probable fix: add an INLINE[n] or NOINLINE[n] pragma for ‘id’
aeson                            >     |
aeson                            > 505 |   "FromJSONKeyCoerce: fmap id"     forall (x :: FromJSONKeyFunction a).
aeson                            >     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
aeson                            >
aeson                            > Data\Aeson\Types\FromJSON.hs:800:35: warning: [-Wunused-matches]
aeson                            >     Defined but not used: ‘v’
aeson                            >     |
aeson                            > 800 | withBoundedScientific_ whenFail f v@(Number scientific) =
aeson                            >     |                                   ^
aeson                            >
aeson                            > Data\Aeson\Types\FromJSON.hs:805:5: warning: [-Wname-shadowing]
aeson                            >     This binding for ‘exponent’ shadows the existing binding
aeson                            >       imported from ‘Prelude.Compat’ at Data\Aeson\Types\FromJSON.hs:83:1-21
aeson                            >       (and originally defined in ‘GHC.Float’)
aeson                            >     |
aeson                            > 805 |     exponent = base10Exponent scientific
aeson                            >     |     ^^^^^^^^
hslua                            > [17 of 19] Compiling Foreign.Lua.FunctionCalling
hslua                            > [18 of 19] Compiling Foreign.Lua.Module
hslua                            > [19 of 19] Compiling Foreign.Lua
aeson                            > [13 of 25] Compiling Data.Aeson.Internal
aeson                            > [14 of 25] Compiling Data.Aeson.Internal.Time
aeson                            > [15 of 25] Compiling Data.Aeson.Encoding.Builder
aeson                            > [16 of 25] Compiling Data.Aeson.Encoding.Internal
aeson                            > [17 of 25] Compiling Data.Aeson.Encoding
aeson                            > [18 of 25] Compiling Data.Aeson.Types.ToJSON
aeson                            > [19 of 25] Compiling Data.Aeson.Types.Class
aeson                            > [20 of 25] Compiling Data.Aeson.Types
aeson                            > [21 of 25] Compiling Data.Aeson.Text
aeson                            > [22 of 25] Compiling Data.Aeson
aeson                            > [23 of 25] Compiling Data.Aeson.TH
aeson                            > [24 of 25] Compiling Data.Aeson.QQ.Simple
aeson                            > [25 of 25] Compiling Data.Aeson.Encode
aeson                            >
aeson                            > copy/register
aeson                            > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\aeson-1.4.5.0-36mBXjfsHvfDHOxMEoZc6o
aeson                            > Registering library for aeson-1.4.5.0..
hslua                            > copy/register
hslua                            > Installing library in C:\sr\snapshots\bbfe763e\lib\i386-windows-ghc-8.6.5\hslua-1.1.2-5SlkKdOYoXr8nlwi6jX09U
hslua                            > Registering library for hslua-1.1.2..
Progress 83/107

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the error:

       [S-7011]
       While building package network-2.8.0.1 (scroll up to its section to see the error) using:
       C:\Users\james\AppData\Local\Temp\stack-7a47d278738dcf6e\network-2.8.0.1\.stack-work\dist\cb766d2c\setup\setup --verbose=1 --builddir=.stack-work\dist\cb766d2c configure --with-ghc=C:\Users\james\AppData\Local\Programs\stack\i386-windows\ghc-8.6.5\bin\ghc-8.6.5.exe --with-ghc-pkg=C:\Users\james\AppData\Local\Programs\stack\i386-windows\ghc-8.6.5\bin\ghc-pkg.exe --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\bbfe763e\pkgdb --libdir=C:\sr\snapshots\bbfe763e\lib --bindir=C:\sr\snapshots\bbfe763e\bin --datadir=C:\sr\snapshots\bbfe763e\share --libexecdir=C:\sr\snapshots\bbfe763e\libexec --sysconfdir=C:\sr\snapshots\bbfe763e\etc --docdir=C:\sr\snapshots\bbfe763e\doc\network-2.8.0.1 --htmldir=C:\sr\snapshots\bbfe763e\doc\network-2.8.0.1 --haddockdir=C:\sr\snapshots\bbfe763e\doc\network-2.8.0.1 --dependency=base=base-4.12.0.0 --dependency=bytestring=bytestring-0.10.8.2 --extra-include-dirs=C:\Users\james\AppData\Local\Programs\stack\i386-windows\ghc-8.6.5\bin\../mingw/include --extra-include-dirs=C:\Users\james\AppData\Local\Programs\stack\i386-windows\msys2-20200517\mingw32\include --extra-lib-dirs=C:\Users\james\AppData\Local\Programs\stack\i386-windows\ghc-8.6.5\bin\../mingw/lib --extra-lib-dirs=C:\Users\james\AppData\Local\Programs\stack\i386-windows\msys2-20200517\mingw32\lib --extra-lib-dirs=C:\Users\james\AppData\Local\Programs\stack\i386-windows\msys2-20200517\mingw32\bin --exact-configuration --ghc-option=-fhide-source-paths
       Process exited with code: ExitFailure 77
[ERROR] Compilation failed

Would you have any further insights?

The actual error is in the middle of the log:

network                          > checking whether the C compiler works... no
network                          > configure: error: in `/c/Users/james/AppData/Local/Temp/stack-7a47d278738dcf6e/network-2.8.0.1/.stack-work/dist/cb766d2c/build':
network                          > configure: error: C compiler cannot create executables
network                          > See `config.log' for more details

It likely means that your build environment is not set up properly. I’d normally use a MinGW / MSYS shell or the one which comes with Git instead of a basic cmd.exe. That said, Stack is normally good at setting up Windows build environment out of the box, maybe @mpilgrem might have further insights.