0

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

2
  • Stack also has a with-gcc option, which might be what you need.
    – duplode
    Commented Mar 1, 2024 at 1:17
  • Although I checked out documentation I totally missed it, guess I was looking on the wrong place. Thanks a lot!
    – dec
    Commented Mar 1, 2024 at 6:21

1 Answer 1

1

As pointed out in the comment by @duplode there's a --with-gccflag that allows to specify the desired C compiler that stack uses

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.