Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
I want to override default GCC location, which is required in some FFI use-cases. Originally, the discussion was started on haskell-stack mailing group.
Let's use some basic example: https://github.com/kgadek/ffi-stack-test . I want to compile this FFI code that uses C++. The important part: I'm using OS X 10.9 so
First: cabal. Only having the repo,
The obvious wart is that this is a global setting, but I could live with that.
But how to make that work in stack? The output from
This is the error I have seen when trying to fix the project for cabal. Verbose output: http://lpaste.net/136624
Is there any workaround before this feature is implemented, except for symlinking
Stack does not currently provide an option to override the GCC location. I'm not sure if you've tried this, but could you adjust the PATH environment variable so the desired
In general, I'm thinking it might be nice for stack to support most of the
It seems like there wouldn't be much point in accepting a
Also, where do these happen:
And finally, which stack commands should accept the new options?
The actual call to configure happens here - note that it's computing and passing in
I wouldn't want to see this add a ton of flags to --help, though (see #1333).
How about instead, we just add the ability to specify any cabal configure flags (#846)? The downside of this is that it wouldn't allow overriding the programs used directly by stack.
Regardless of what the options end up being, here is a hotfix for users that I was able to narrow down.
hfsevents-0.1.6 could not be built, and the error message led me to this issue. I had Homebrew installed GCC in /usr/local/bin/gcc and apparently hfsevents needs Clang (installed by XCode at /usr/bin/gcc). I could try linking /usr/bin/gcc as /usr/local/bin/gcc, but that would only work because I have sudo access on the machine. In the general case, we need to change the path to GCC that stack uses. Changing the PATH environment variable is not enough; I straight up removed /usr/local/bin/gcc and stack just complained that it didn't exist.
Instead, search for the string
$ ag '/usr/local/bin/gcc' ~/.stack/ ~/.stack/programs/x86_64-osx/ghc-7.10.3/lib/ghc-7.10.3/settings 2: ("C compiler command", "/usr/local/bin/gcc"), 5: ("Haskell CPP command","/usr/local/bin/gcc"), $ sed -i -e 's,/usr/local/bin/gcc,/usr/bin/gcc,' ~/.stack/programs/x86_64-osx/ghc-7.10.3/lib/ghc-7.10.3/settings
The absolute path will change depending on which GHC you've configured stack to use.