Cabal suddenly stopped building my project. Nothing much changed in the project itself since the last successful build, I guess only OS updates were installed.
The error I get on cabal v2-build
is:
Undefined symbols for architecture x86_64:
"_u_errorName_70", referenced from:
___hs_u_errorName in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_close_70", referenced from:
___hs_ucnv_close in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_fromUChars_70", referenced from:
___hs_ucnv_fromUChars in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_getMaxCharSize_70", referenced from:
___get_max_bytes_for_string in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_open_70", referenced from:
___hs_ucnv_open in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_setFallback_70", referenced from:
___hs_ucnv_setFallback in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_toUChars_70", referenced from:
___hs_ucnv_toUChars in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
Additionally, cabal repl
stopped working as well:
<command line>: dlopen(/Users/user/.cabal/store/ghc-8.10.7/lib/libHStxt-c-0.7.1.0-21406b30-ghc8.10.7.dylib, 0x0005): Library not loaded: '/usr/local/opt/icu4c/lib/libicuuc.70.dylib'
Referenced from: '/Users/user/.cabal/store/ghc-8.10.7/lib/libHStxt-c-0.7.1.0-21406b30-ghc8.10.7.dylib'
Reason: tried: '/usr/local/opt/icu4c/lib/libicuuc.70.dylib' (no such file), '/usr/local/lib/libicuuc.70.dylib' (no such file), '/usr/lib/libicuuc.70.dylib' (no such file), '/usr/local/Cellar/icu4c/71.1/lib/libicuuc.70.dylib' (no such file), '/usr/local/lib/libicuuc.70.dylib' (no such file), '/usr/lib/libicuuc.70.dylib' (no such file)
Error: cabal: repl failed for exe:appname from
appname-1.0.0
I am on ghc 8.10.7
, macOS Monterey 12.6.1 and cabal --version
outputs
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library
Version of icu4c
is 71.1, it is installed using brew
.
How could I make the project compile successfully again?
CodePudding user response:
Well, it looks like the text-icu
package got built against icu4u
version 70, and then your system upgraded to version 71. Unless you feel like downgrading icu4u
, you should try deleting the package store (that is, ~/.cabal/store/ghc-<version>/
). The next run of cabal v2-build
in your project will then go and rebuild all its dependencies, including the packages rendered "stale" by your system upgrade. Note that deleting the store may break installed executables.