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

Using Cabal-1.22 for Setup.hs with GHC-7.8 #1002

Closed
mwu-tow opened this Issue Sep 17, 2015 · 10 comments

Comments

Projects
None yet
2 participants
@mwu-tow
Contributor

mwu-tow commented Sep 17, 2015

Hello,
I have a package that uses custom Setup.hs file that requires Cabal library at least in version 1.22. I need to build the package with GHC 7.8.

With cabal it is enough to cabal install cabal — and then Setup.hs will be linked against the latest Cabal library. Using GHC 7.8 with it works seamlessly.

How can I tell stack to use newer Cabal version for Setup.hs?

I tried adding Cabal-1.22.4.0 to the extra-deps field but it does not help — apparently the newer Cabal will be available to the built package but not its Setup.hs. It still gets Cabal-1.18.1.5 that comes with GHC 7.8.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 17, 2015

There's an --upgrade-cabal argument to stack setup that should do what you
want.

Can we move this q&a to stack overflow so that others can find this answer
more easily in the future?

On Thu, Sep 17, 2015, 2:03 PM Michał Wawrzyniec Urbańczyk <
notifications@github.com> wrote:

Hello,
I have a package that uses custom Setup.hs file that requires Cabal
library at least in version 1.22. I need to build the package with GHC 7.8.

With cabal it is enough to cabal install cabal — and then Setup.hs will
be linked against the latest Cabal library. Using GHC 7.8 with it works
seamlessly.

How can I tell stack to use newer Cabal version for Setup.hs?

I tried adding Cabal-1.22.4.0 to the extra-deps field but it does not
help — apparently the newer Cabal will be available to the built package
but not its Setup.hs. It still gets Cabal-1.18.1.5 that comes with GHC
7.8.


Reply to this email directly or view it on GitHub
#1002.

@mwu-tow

This comment has been minimized.

Contributor

mwu-tow commented Sep 17, 2015

@snoyberg
Thank you for such quick answer. Yes, of course — should I just raise that question on SO and post the link here?
Still, please let's continue for a while here, since this format better works for follow-up doubts.

I'm not sure if it will work for me. I use a custom (patched) GHC 7.8.4 build, the GHC downloaded by stack setup won't work for me. I was sure that stack setup with --upgrade-cabal will just install a new GHC with overwritten cabal so I didn't try it before.
Now I tried stack setup 7.8.4 --upgrade-cabal and it detected my custom build from PATH:

Trying to upgrade Cabal library on a GHC not installed by stack.
This may fail, caveat emptor!
Installing Cabal-1.22.4.0 to replace 1.18.1.5
[ 1 of 79] Compiling Distribution.GetOpt ( Distribution\GetOpt.hs, Distribution\GetOpt.o )
[snip…]
[79 of 79] Compiling Main             ( Setup.hs, Setup.o )
Linking Setup.exe ...
Did not find executable at specified path: C:\Users\MWURB_~1\AppData\Local\Temp\stack-cabal-upgrade19588\Cabal-1.22.4.0\Setup

Apparently it failed. And so it is — stack build still uses the old Cabal after that.
Am I doing something wrong? It's not clear to me what actually happened.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 17, 2015

That may be a bug on Windows, quite unrelated. Let me check something.

snoyberg added a commit that referenced this issue Sep 17, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 17, 2015

Can you try upgrading to stack master (stack upgrade --git) and running that command again?

@snoyberg snoyberg added this to the Support milestone Sep 17, 2015

@mwu-tow

This comment has been minimized.

Contributor

mwu-tow commented Sep 17, 2015

I tried stack upgrade --git and it failed: https://gist.github.com/mwu-tow/c171f157bbe55de326d8

My current stack --version is Version 0.1.4.0, Git revision dac8cfe51802e08edb523b80c51cf35e21933513 (1722 commits) X86_64

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 17, 2015

Looks like you're hitting the 32k character limit on Windows... try this executable instead. https://s3.amazonaws.com/download.fpcomplete.com/michael/stack-f24a2474b06722244acae2b3159be819cda6bb20.zip

@mwu-tow

This comment has been minimized.

Contributor

mwu-tow commented Sep 17, 2015

Thanks.
Interestingly, the corrected stack when asked to stack setup 7.8.4 --upgrade-cabal starts downloading a new GHC 7.8.4 package instead of updating the existing one — not the thing we want to check.

Could it be cause my GHC is 64-bit and stack you provided is 32-bit and stack tries to install GHC with the same architecture? Can I somehow tell stack setup to use 64-bit GHC? Help says only about specifying GHC version, not architecture.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 17, 2015

There's a --arch argument, use stack --help to see help about it. --arch x86_64 should do it.

@mwu-tow

This comment has been minimized.

Contributor

mwu-tow commented Sep 17, 2015

Oh, right, sorry about that — I'm still getting started with stack.

It works! Now my package builds correctly.
Thank you very much for the great support, I'm impressed. :)

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 17, 2015

Sure, no problem, glad it's working!

On Thu, Sep 17, 2015 at 3:18 PM, Michał Wawrzyniec Urbańczyk <
notifications@github.com> wrote:

Oh, right, sorry about that — I'm still getting started with stack.

It works! Now my package builds correctly.
Thank you very much for the great support, I'm impressed. :)


Reply to this email directly or view it on GitHub
#1002 (comment)
.

@snoyberg snoyberg closed this Sep 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment