I'm learning Haskell and I'm setting up my system for development.
I'm on MacOS and trying to install hoogle
locally with stack install hoogle
fails because the compilation of some libraries fails with the error
error: gcc-13: error: unrecognized command-line option '--target=x86_64-apple-darwin--lflag=--target=x86_64-apple-darwin'
I'm pretty sure that the error is due to the fact that I have multiple C/C++ compilers in my system and the compilation is using gcc-13
(which is linked to GCC 13.2.0) rather than gcc
(the system compiler which is linked to clang 15.0.0)
My intuition has been further confirmed by installing hoogle
first with cabal install hoogle
, which led to the same error, and then with cabal install hoogle --with-gcc=/usr/bin/gcc
which successfully installed it.
I was then wondering if it was somehow possible to specify the C compiler used by stack
As pointed out in the comment by @duplode there's a --with-gcc
flag that allows to specify the desired C compiler that stack
uses