Skip to content
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

GHCJS stack path not consistent #2436

Closed
shulhi opened this issue Aug 4, 2016 · 6 comments
Closed

GHCJS stack path not consistent #2436

shulhi opened this issue Aug 4, 2016 · 6 comments

Comments

@shulhi
Copy link

shulhi commented Aug 4, 2016

I have two projects, one is a GHC project and the other is GHCJS project.

For the GHCJS project, my stack.yaml looks like the normal setup as outlined in Stack's official guide for setting up GHCJS project.

Running stack --compiler ghcjs-0.2.0.20160414_ghc-7.10.3 path on GHCJS project return,

...
compiler-exe: /home/shulhi/.stack/programs/x86_64-linux/ghcjs-0.2.0.20160414_ghc-7.10.3/bin/ghcjs
compiler-bin: /home/shulhi/.stack/programs/x86_64-linux/ghcjs-0.2.0.20160414_ghc-7.10.3/bin
...

But when running the same command on GHC project, I get

compiler-exe: /home/shulhi/.cabal/bin/ghcjs
compiler-bin: /home/shulhi/.cabal/bin

I was expecting to get the same result as running on GHCJS project. Is this an intended behavior?

@mgsloan mgsloan added this to the Support milestone Aug 4, 2016
@mgsloan
Copy link
Contributor

mgsloan commented Aug 4, 2016

compiler-exe: /home/shulhi/.cabal/bin/ghcjs

I'm surprised you get ghcjs for a ghc project. What's with that?

This does seem to be intended behavior. .cabal/bin/ is probably on your PATH, and so stack is using the ghc from there since its version matches. We're planning to change the behavior to default to using a stack installed ghc, since it sometimes causes people problems: #2221

@shulhi
Copy link
Author

shulhi commented Aug 4, 2016

@mgsloan

If I run stack path on the GHC project, I get

compiler-exe: /home/shulhi/.cabal/bin/ghc
compiler-bin: /home/shulhi/.cabal/bin

But I want to compile it againts GHCJS, thus the --compiler flag. I have conditional macro for that GHC project that has GHCJS stuff in it. It works fine if I import that GHC project (it's a library) into GHCJS project and compile it. That will trigger the macro. But I want to be able to compile the GHC project with GHCJS flag on a standalone basis. I believe that's what --compiler is for.

Do you know any way I could overwrite the compiler-exe and compiler-bin? The --no-system-ghc did the trick. But it still can't find my GHCJS packages

--  While attempting to add dependency,
    Could not find package ghcjs-base in known packages

@mgsloan
Copy link
Contributor

mgsloan commented Aug 5, 2016

Ah, I see. Strange! Does compiler-check: match-exact in your stack.yaml fix it too? (instead of --no-system-ghc). I've put down a potential enhancement for this here: #2442

In order to find your GHCJS packages, they will need to be in the stack configuration - it won't see things you've previously built / installed.

@shulhi
Copy link
Author

shulhi commented Aug 5, 2016

Yeah having compiler-check: match-exact works too.

I don't quite understand that I need to have GHCJS in the stack (still new to Haskell/Stack). Does that mean I need to maintain two different stack.yaml, one for building with GHC and the other for GHCJS? My requirement is that I need to be able to build the project with either GHC and GHCJS (I was assuming --compiler will do the trick).

My initial understanding was that I can do that by having --compiler flag. The official stack docs seems to imply that unless I misunderstood how it works. Thanks again for taking the time to answer my queries.

@mgsloan
Copy link
Contributor

mgsloan commented Aug 5, 2016

Yeah, actually you don't need a separate stack.yaml, as long as the build with GHC doesn't depend on any packages that are GHCJS-only. Not sure why it wouldn't be able to find ghcjs-base, I'd suggest setting it up again

@mgsloan
Copy link
Contributor

mgsloan commented Oct 18, 2016

Closing this, as it's an old support ticket. If you think this is in error, please comment with more info.

@mgsloan mgsloan closed this as completed Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants