I have an almost pure Haskell project that I compile to a static executable using an Alpine Docker base image and a build script that installs all of Haskell’s and ghcups Alpine dependencies and then installs ghcup and basically does cabal build. So far, so good. It works!
However, once I add the microlens-th
dependency and actually use it, for instance in this dummy snippet in Main
:
data AppState = State1 {_state11 :: Int, _state12 :: Int}
makeLenses ''AppState
I get this linker error:
167.0 <no location info>: error:
167.0 Error relocating /root/.cabal/store/ghc-9.8.4-04ad/hs-asapo-0.9.1-75d4d1bac2189d3038e18192ad5d3761b640dba0a457200cd21dbe936e615a99/lib/libHShs-asapo-0.9.1-75d4d1bac2189d3038e18192ad5d3761b640dba0a457200cd21dbe936e615a99-ghc9.8.4.so: _ZSt17__throw_bad_allocv: symbol not found
I’ve talked to the author of microlens-th
and we’re in agreement that it’s probably not a microlens-th issue, because there is nothing special about it.
But what could cause this weird error then? It happens both with ghc-9.6 and ghc-9.8. I haven’t tried newer ones yet.