Stack: Hfsevents not building, Objective-C not recognized

Created on 25 Dec 2015  路  11Comments  路  Source: commercialhaskell/stack

I'm getting an error building hfsevents. More details found here. Can anyone help?

os x / macos

Most helpful comment

Ah yes, removing /usr/local/bin/gcc worked. I guess since XCode installed the /usr/bin/gcc executable, it's better to use that one anyway. Thanks!

All 11 comments

I already followed the advice of calling brew install gcc48 --with-all-languages and I uninstalled all Haskell versions, only using the ghc within stack.

It builds fine for me just using gcc from xcode-select --install, but I'm on El Capitan
But even in Yosemite I don't think gcc48 from homebrew would be necessary, though

I'm on Yosemite, and my Xcode is up to date. The strangest thing was, it was working before, but it suddenly stopped working and I don't remember doing anything to mess with gcc.

Very odd. I would uninstall gcc48 and reinstall command line tools using xcode-select --install and try building it again. Paste a link to a paste of the verbose output if it fails again :)

Brandon: ~/path/to/project/ (git:master)
(env)$ brew uninstall gcc48
Uninstalling /usr/local/Cellar/gcc48/4.8.4... (4862 files, 354M)

Brandon: ~/path/to/project/ (git:master)
(env)$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Brandon: ~/path/to/project/ (git:master)
(env)$ stack build
hfsevents-0.1.6: configure
tf-random-0.5: download
text-binary-0.2.1: download
cpphs-1.19.3: download
hfsevents-0.1.6: build
text-binary-0.2.1: configure
text-binary-0.2.1: build
tf-random-0.5: configure
text-binary-0.2.1: copy/register
transformers-compat-0.4.0.4: copying precompiled package
tf-random-0.5: build
cpphs-1.19.3: configure
cpphs-1.19.3: build
MonadRandom-0.4.1: configure
MonadRandom-0.4.1: build
MonadRandom-0.4.1: copy/register
tf-random-0.5: copy/register
cpphs-1.19.3: copy/register
Progress: 6/85
--  While building package hfsevents-0.1.6 using:
      /Users/Brandon/.stack/setup-exe-cache/x86_64-osx/setup-Simple-Cabal-1.22.4.0-ghc-7.10.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.4.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /Users/Brandon/path/to/project/.stack-work/logs/hfsevents-0.1.6.log

    Configuring hfsevents-0.1.6...
    Building hfsevents-0.1.6...
    Preprocessing library hfsevents-0.1.6...
    [1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/System/OSX/FSEvents.o )
    gcc: error: language objective-c not recognized
    gcc: error: language objective-c not recognized

I'm on Yosemite with Xcode 7.2 and have no trouble installing hfsevents. This sounds like a system problem and not something specific to Stack. I'd be curious whether cabal-install fares better (e.g. try running cabal install hfsevents).

cabal install hfsevents works, but stack is still not working. could it be some PATH issue, where stack builds on some other PATH?

Yes, I'd suggest using stack --verbose and comparing the arguments passed to ghc with the verbose output from cabal-install to see what might be different.

and perhaps the output of stack exec -- ghc --info and which -a gcc are also useful

Ok. So cabal install hfsevents -v had the line /usr/bin/gcc -dumpversion whereas stack exec -- ghc --info included the line ("C compiler command","/usr/local/bin/gcc"). However, /usr/local/bin/gcc -dumpversion gave me 4.9.2 and /usr/bin/gcc -dumpversion gave me 4.2.1. Why would the older version work and not the newer one?

Should I just change the gcc stack is using? How do I update the settings for stack's ghc?

Why would the older version work and not the newer one?

Most likely /usr/local/bin/gcc -v does not have objc lang enabled and it is probably better rm it to avoid future compilers installed by stack from picking it up?

Should I just change the gcc stack is using? How do I update the settings for stack's ghc?

I would make sure stack is using a ghc installed by it and this steps should help updating the c compiler

Ah yes, removing /usr/local/bin/gcc worked. I guess since XCode installed the /usr/bin/gcc executable, it's better to use that one anyway. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fizruk picture fizruk  路  3Comments

igrep picture igrep  路  3Comments

srghma picture srghma  路  3Comments

symbiont-joseph-kachmar picture symbiont-joseph-kachmar  路  3Comments

Toxaris picture Toxaris  路  4Comments