-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow overriding gcc-location #593
Comments
For cabal-install you can do |
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 |
👍 |
👍, sounds like a good idea. |
@kgadek Interested in taking a stab at this one then, since you've got a good use case to test it out on? |
Not this week for sure, but maybe next? I'll try to dive into internals soon, can't give a date though. I'll keep this thread up-to-date when I start working on this one. TL;DR: if anyone wants this one, go for it. If no one, then I'll try this. |
From
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. |
Discussion about adding arbitrary cabal configure options: #1438 |
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. |
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
/usr/bin/gcc
is actually clang; I have GCC 5.0 from homebrew in/usr/local/bin/gcc-5
.First: cabal. Only having the repo,
cabal build
fails the first time and magically works the second — vide: http://lpaste.net/136600 . After some struggling, I finally made it work by adding this in the~/.cabal/config
: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
stack build
: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
/usr/bin/gcc
?The text was updated successfully, but these errors were encountered: