Hakyll Error Watching and Building

Hi,

I have a blog I use Hakyll for and up until recently it has worked fine. Now, though, when I try - cabal new-run site watch - I get the following error:

ld: warning: ignoring duplicate libraries: '-lm', '-lz'
ld: Undefined symbols:
  _iconv, referenced from:
      _hs_iconv in libHSbase-4.17.2.1.a[6](iconv.o)
  _iconv_close, referenced from:
      _hs_iconv_close in libHSbase-4.17.2.1.a[6](iconv.o)
  _iconv_open, referenced from:
      _hs_iconv_open in libHSbase-4.17.2.1.a[6](iconv.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ghc-9.4.8: `gcc' failed in phase `Linker'. (Exit code: 1)

The error is *identical* I think to `cabal new-run site build`:
ld: warning: ignoring duplicate libraries: '-lm', '-lz'
ld: Undefined symbols:
  _iconv, referenced from:
      _hs_iconv in libHSbase-4.17.2.1.a[6](iconv.o)
  _iconv_close, referenced from:
      _hs_iconv_close in libHSbase-4.17.2.1.a[6](iconv.o)
  _iconv_open, referenced from:
      _hs_iconv_open in libHSbase-4.17.2.1.a[6](iconv.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ghc-9.4.8: `gcc' failed in phase `Linker'. (Exit code: 1)


Does anyone know how to fix this linker error?

The GCC version I am using is Apple clang version 15.0.0 (clang-1500.1.0.2.5).

1 Like

Although you are using Cabal (the tool), this reminds me of a Stack issue: Build 2.11.1 from source fails on macOS with linker error to symbol `iconv` · Issue #6182 · commercialhaskell/stack · GitHub. The input there from @turboMaCk may help you.

1 Like