Running stack setup for my project (configured to resolve with lts-2.22), I get this:
% stack setup
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-7.8.4.
Running /usr/bin/make install exited with ExitFailure 2
/Applications/Xcode.app/Contents/Developer/usr/bin/make -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES
mk/config.mk:496: *** missing separator. Stop.
make: *** [install] Error 2
Some more information:
% stack --version
Version 1.0.0, Git revision 3bc26237b5b3c387b8fd564459ea4dd88fd58b30 (2939 commits) x86_64
% /usr/bin/make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
I get the same output when I run /Applications/Xcode.app/Contents/Developer/usr/bin/make --version as well. Also, if I try the lts-3.20 resolver the outcome is exactly the same—same line number (mk/config.mk:496) and everything.
I tried the following and it didn't help:
% ln -s `which gmake` ~/bin/make
% rehash
% which make
/Users/sacundim/bin/make
% make --version
GNU Make 4.1
Built for x86_64-apple-darwin14.3.0
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
% stack setup
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
Running /usr/local/bin/gmake install exited with ExitFailure 2
/usr/local/bin/gmake -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES
Makefile:24: recipe for target 'install' failed
mk/config.mk:496: *** missing separator. Stop.
gmake: *** [install] Error 2
Hmm, I have no trouble installing GHC on OS X 10.10.5 and XCode 7.2. Note that I didn't have to do any symlinking of gmake. My "native" make is already GNU make (and I don't have any gmake on my system).
$ which make
/usr/bin/make
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
Well, I'm at a loss at how to provide a reproduction, given that I reliably get the same error every single time I try this. Clearly there's some environmental difference between your machine and the one I'm running in, but without some pointers on what to look for, all I can say is I can reproduce it every time on my machine, and the steps are "follow the official instructions."
To clarify my earlier comment, note that my machine's native make is GNU Make 3.81 as well. I just happened to have a newer GNU Make lying around from a Homebrew package, and that's what the gmake symlink was about...
looks like this a fresh try at stack? if so, it shouldn't be too much trouble removing ~/.stack just in case
and try the following:
assuming stack is found in the following $PATH and you have command line tools installed (xcode-select --install)
PATH=$HOME/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin stack setup -v
Thanks luigy! Yeah, specifying the path very carefully like that does get past the problem. Now I just have to track down which of the things in the path is the culprit, and I'll report back with my results.
Aha! I've found the problem. Some time in the depths of time (2013 or 2014), I ran into some Haskell Platform on OS X difficulties so I ended up doing a version of what's described in this page:
As part of this, I made a symlink from ~/bin/gcc to /usr/local/bin/gcc-4.2. Renaming this symlink to ~/bin/not-gcc solves my issue.
Perhaps there is some sort of sanity check that Stack can perform to validate that the environment meets its assumptions about GCC versions? If you've used Homebrew and its brew doctor command, maybe there ought to be some sort of stack doctor command?
We have the exact same error, but the explicit PATH does not help.
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
$ gcc -v
couldn't understand kern.osversion `14.5.0'
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Using stack installed with brew, and it is downloading lts-6.15.
fyi, I had a similar issue:
````
[error] Running /usr/bin/make install in directory /Users/nehal/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/ exited with ExitFailure 2
mk/config.mk:521: * missing separator. Stop.
@(Stack/Setup.hs:991:21)
2017-10-16 07:16:01.831719: [error]
Error: Error encountered while installing GHC with
make install
run in /Users/nehal/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/
````
Here is the line from mk/config.mk:521:
519 WhatGccIsCalled = /usr/bin/gcc
520 GccVersion = 9.0.0
521 8.0
522 ifeq "$(phase)" "0"
...
output from gcc:
nehal$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Found CUDA installation: /usr/local/cuda, version 8.0
It looks like the version detection is getting confused by the cuda installation (and so is thinking the version is something like "9.0.0\n8.0")
I imagine this is something for upstream (e.g. ghc mainainters), but I'm just rebooting my "try to grok Haskell" efforts, so I am going to take the lazy approach and report it here....
Thanks for stack!
Thanks @habemus-papadum , I had the same issue and was able to get GHC installed after removing CUDA
I am also experiencing this issue; no doubt, the solution from @habemus-papadum will work, but might there be a workaround for those of us who don't wish to uninstall CUDA?
Edit: I've uninstalled CUDA, and stack setup worked as expected (so this issue continues to be resolved). Though it would be nice to see a real fix for this upstream.
I filed a report upstream: https://ghc.haskell.org/trac/ghc/ticket/14526
Not a fix, but it seems that gcc -v only looks for the CUDA installation at a specific path, so it also works by temporarily relocating /usr/local/cuda instead of doing a full uninstall.
Most helpful comment
I filed a report upstream: https://ghc.haskell.org/trac/ghc/ticket/14526