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

Locally installed GHC fails to compile sanity check #497

Closed
pharpend opened this issue Jul 3, 2015 · 25 comments
Closed

Locally installed GHC fails to compile sanity check #497

pharpend opened this issue Jul 3, 2015 · 25 comments

Comments

@pharpend
Copy link
Contributor

pharpend commented Jul 3, 2015

On stack setup, git tree at https://git.gnu.io/snowdrift/snowdrift.

The GHC located at /home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc failed to compile a sanity check. Please see:

    https://github.com/commercialhaskell/stack/wiki/Downloads

for more information. Exception was:
Running /home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc /tmp/stack-sanity-check28367/Main.hs exited with ExitFailure 1

/tmp/stack-sanity-check28367/Main.hs:1:8:
    Could not find module ‘Distribution.Simple’
    There are files missing in the ‘Cabal-1.22.0.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.


This was after I installed stack through the AUR package.

@snoyberg
Copy link
Contributor

snoyberg commented Jul 3, 2015

That's quite unexpected, I haven't seen anything like that before. What happens if you run:

/home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc-pkg list

@pharpend
Copy link
Contributor Author

pharpend commented Jul 3, 2015

On Fri, Jul 03, 2015 at 04:20:16AM -0700, Michael Snoyman wrote:

That's quite unexpected, I haven't seen anything like that before. What happens if you run:

/home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc-pkg list

A big list of packages. Many of them are colored red:
http://ix.io/jrN. Note the advisory about broken packages.

When I run /home/pete/.stack/.../ghc-pkg check, this is the output:
http://ix.io/jrO.

Peter Harpending

@snoyberg
Copy link
Contributor

snoyberg commented Jul 3, 2015

Oh I see the problem. We need to limit the sanity check to the global
database only. Can you test if actually using this new GHC via stack build
succeeds? I think it should.

On Fri, Jul 3, 2015, 10:38 AM Peter Harpending notifications@github.com
wrote:

On Fri, Jul 03, 2015 at 04:20:16AM -0700, Michael Snoyman wrote:

That's quite unexpected, I haven't seen anything like that before. What
happens if you run:

/home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc-pkg list

A big list of packages. Many of them are colored red:
http://ix.io/jrN. Note the advisory about broken packages.

When I run /home/pete/.stack/.../ghc-pkg check, this is the output:
http://ix.io/jrO.

Peter Harpending


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

@pharpend
Copy link
Contributor Author

pharpend commented Jul 3, 2015

@snoyberg My computer is a bit indisposed at the moment, but the tl;dr is the build command succeeds, but then stack exec -- yesod devel complains about missing packages.

@snoyberg
Copy link
Contributor

snoyberg commented Jul 3, 2015

Do you have the newest version of yesod-bin? Read the newest blog post on
yesodweb.com. I'm on my phone right now so can't provide more information.

On Fri, Jul 3, 2015, 12:51 PM Peter Harpending notifications@github.com
wrote:

@snoyberg https://github.com/snoyberg My computer is a bit indisposed
at the moment, but the tl;dr is the build command succeeds, but then stack
exec -- yesod devel complains about missing packages.


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

@pharpend
Copy link
Contributor Author

pharpend commented Jul 3, 2015

On Fri, Jul 03, 2015 at 12:54:18PM -0700, Michael Snoyman wrote:

Do you have the newest version of yesod-bin? Read the newest blog post on
yesodweb.com. I'm on my phone right now so can't provide more information.

I think this is another bug, but yesod-bin doesn't respond to
--version. stack exec -- yesod version says 1.4.11, which I recall was
the version that supposedly works with Stack. It's also the latest
version in Hackage.

Are you back in the states, @snoyberg? It's like 1 AM in Israel.

Peter Harpending

@snoyberg
Copy link
Contributor

snoyberg commented Jul 3, 2015

Yes, I'm in California right now.

Did you run stack build before stack exec -- yesod devel?

@pharpend
Copy link
Contributor Author

pharpend commented Jul 3, 2015

@snoyberg Yep.

@pharpend
Copy link
Contributor Author

pharpend commented Jul 3, 2015

@snoyberg Here is the full error:

[src/snowdrift master] % stack build && stack exec -- yesod devel                                                          pete@locust
stack build  1.89s user 1.48s system 243% cpu 1.385 total
Yesod devel server. Press ENTER to quit
Application can be accessed at:

http://127.0.0.1:3000
https://127.0.0.1:3443
If you wish to test https capabilities, you should set the following variable:
  export APPROOT=https://127.0.0.1:3443

WARNING: the following source files are not listed in exposed-modules or other-modules:
./Handler/About.hs
./SnowdriftEmailDaemon.hs
./SnowdriftSendmail.hs
Resolving dependencies...
Configuring Snowdrift-0.1.4...
cabal: At least the following dependencies are missing:
Diff -any,
async -any,
attoparsec -any,
authenticate -any,
blaze-builder -any,
blaze-html -any,
blaze-markup -any,
cmdargs -any,
conduit -any,
data-default -any,
email-validate -any,
esqueleto -any,
fast-logger -any,
github -any,
hit -any,
hjsmin -any,
hourglass -any,
http-conduit -any,
http-types -any,
lifted-base -any,
mime -any,
mime-mail -any,
monad-logger -any,
mtl -any,
mwc-random -any,
pandoc -any,
path-pieces -any,
persistent -any,
persistent-postgresql -any,
persistent-template -any,
random -any,
regex-tdfa -any,
resourcet -any,
semigroups -any,
shakespeare -any,
stm -any,
temporary -any,
text -any,
titlecase -any,
wai-extra -any,
wai-logger -any,
warp -any,
yaml -any,
yesod ==1.4.*,
yesod-auth -any,
yesod-auth-hashdb -any,
yesod-core -any,
yesod-form -any,
yesod-markdown -any,
yesod-newsfeed -any,
yesod-static -any
^Cuser interrupt
stack exec -- yesod devel  3.11s user 0.59s system 58% cpu 6.317 total

@snoyberg
Copy link
Contributor

snoyberg commented Jul 3, 2015

I've pushed a commit that should make the sanity check more resilient to the issue you mentioned above. Sanity check should now succeed.

Can you also include the output for stack exec -- yesod version?

@pharpend
Copy link
Contributor Author

pharpend commented Jul 3, 2015

@snoyberg

yesod-bin version: 1.4.11

@snoyberg
Copy link
Contributor

snoyberg commented Jul 4, 2015

I'm about to disappear for the weekend. I just wanted to lay some groundwork on continuing here.

  • It seems like the original issue is resolved, and we're now discussing something completely different. If that's correct, let's close this out and move to another issue
  • I'd like to get to the bottom of what's happening with yesod devel. Superficially it sounds similar to a thread on Reddit http://www.reddit.com/r/haskell/comments/3byf25/stack_hdevtools_together_at_last/csqvy0m. Since I can't reproduce the problem I don't know where to start. If you can sleuth this a bit with the cabal interaction, that will be a great help

@pharpend
Copy link
Contributor Author

pharpend commented Jul 4, 2015

On Fri, Jul 03, 2015 at 06:45:29PM -0700, Michael Snoyman wrote:

  • It seems like the original issue is resolved, and we're now
    discussing something completely different. If that's correct, let's
    close this out and move to another issue

That is not correct. The initial issue, where 'stack setup' is failing
still exists.

Peter Harpending

@snoyberg
Copy link
Contributor

snoyberg commented Jul 5, 2015

@pharpend Did you test out the newest code on master? Can you paste the new results (including stack --version)?

@snoyberg
Copy link
Contributor

snoyberg commented Jul 5, 2015

I just sent an email to the haskell-stack mailing list about the yesod devel issue, let's follow up there.

@snoyberg
Copy link
Contributor

snoyberg commented Jul 5, 2015

@pharpend
Copy link
Contributor Author

pharpend commented Jul 6, 2015

On Sat, Jul 04, 2015 at 09:48:27PM -0700, Michael Snoyman wrote:

@pharpend Did you test out the newest code on master? Can you paste
the new results (including stack --version)?

With the version in master:

[src/snowdrift cleanups] % stack --version
Version 0.1.1.0, Git revision 91fe70306f51eb3d68667a0d6e09a7d7ebbeb2b6
[src/snowdrift cleanups] % stack setup
The GHC located at /home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc failed to compile a sanity check. Please see:

    https://github.com/commercialhaskell/stack/wiki/Downloads

for more information. Exception was:
Running /home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc /tmp/stack-sanity-check27116/Main.hs exited with ExitFailure 1

/tmp/stack-sanity-check27116/Main.hs:1:8:
    Could not find module ‘Distribution.Simple’
    There are files missing in the ‘Cabal-1.22.0.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.
[src/snowdrift cleanups] % stack build
Snowdrift-0.1.4: build
Building Snowdrift-0.1.4...
Preprocessing library Snowdrift-0.1.4...
[103 of 103] Compiling Application      ( Application.hs, .stack-work/dist/x86_64-linux/Cabal-1.18.1.5/build/Application.o )
In-place registering Snowdrift-0.1.4...
Preprocessing executable 'SnowdriftProcessPayments' for Snowdrift-0.1.4...
Linking .stack-work/dist/x86_64-linux/Cabal-1.18.1.5/build/SnowdriftProcessPayments/SnowdriftProcessPayments ...
Preprocessing executable 'Snowdrift' for Snowdrift-0.1.4...
Linking .stack-work/dist/x86_64-linux/Cabal-1.18.1.5/build/Snowdrift/Snowdrift ...
Preprocessing executable 'SnowdriftEmailDaemon' for Snowdrift-0.1.4...
[29 of 32] Compiling Model.Comment    ( Model/Comment.hs, .stack-work/dist/x86_64-linux/Cabal-1.18.1.5/build/SnowdriftEmailDaemon/SnowdriftEmailDaemon-tmp/Model/Comment.o ) [flags changed]

Model/Comment.hs:553:36: Empty 'do' block

Model/Comment.hs:554:25: Not in scope: ‘c’

Model/Comment.hs:557:29: Not in scope: ‘c’

--  While building package Snowdrift-0.1.4 using:
      /home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/runhaskell -package=Cabal-1.18.1.5 -clear-package-db -global-package-db -package-db=/home/pete/.stack/snapshots/x86_64-linux/lts-2.13/7.8.4/pkgdb/ /tmp/stack28920/Setup.hs --builddir=.stack-work/dist/x86_64-linux/Cabal-1.18.1.5/ build
    Process exited with code: ExitFailure 1
stack build  39.83s user 3.86s system 105% cpu 41.562 total

@snoyberg
Copy link
Contributor

snoyberg commented Jul 6, 2015

That version is from 10 days ago, before I wrote my comment above to test master. The easiest way to install from master is to run stack upgrade --git.

@pharpend
Copy link
Contributor Author

pharpend commented Jul 6, 2015

On Sun, Jul 05, 2015 at 05:27:58PM -0700, Michael Snoyman wrote:

That version is from 10 days ago, before I wrote my comment above to
test master. The easiest way to install from master is to run stack
upgrade --git.

You are right, I had my $PATH misconfigured, so I was running
/usr/bin/stack, i.e. the version I installed from the AUR.

Anyway, with the new version of stack, stack setup succeeds:

$ stack --version
Version 0.1.2.0, Git revision dafc5bb91d470fd4fd9bcca93357db839d952320
$ stack setup
Would add the following to PATH: /home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin

stack build has some compiler errors none of my comrades have, but
that's a separate issue.

Thank you for the help! This can be closed now.

@bwbaugh
Copy link

bwbaugh commented Dec 2, 2016

I also had this error. For those landing here from a search, it turns out it was because I had moved my ~/.stack/ and symlink'd it somewhere else. The error went away when I deleted the contents of .stack/ and allowed it to be recreated in the new location. ((( Reminds me of how Python virtualenvs also can't be moved naively after creation. )))

@SooLee
Copy link

SooLee commented Jan 15, 2017

Hi I'm using Amazon Linux (Redhat/CentOS) and I'm getting a similar error.

$ stack setup
The GHC located at /home/ec2-user/.stack/programs/x86_64-linux/ghc-8.0.1/bin/ghc failed to compile a sanity check. Please see:

    http://docs.haskellstack.org/en/stable/install_and_upgrade/

for more information. Exception was:
Running /home/ec2-user/.stack/programs/x86_64-linux/ghc-8.0.1/bin/ghc /tmp/stack-sanity-check4367/Main.hs -no-user-package-db in directory /tmp/stack-sanity-check4367/ exited with ExitFailure 1

[1 of 1] Compiling Main             ( /tmp/stack-sanity-check4367/Main.hs, /tmp/stack-sanity-check4367/Main.o )
Linking /tmp/stack-sanity-check4367/Main ...

/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

I installed stack through curl -sSL https://get.haskellstack.org/ | sh

@snoyberg
Copy link
Contributor

snoyberg commented Jan 17, 2017 via email

@EasyArray
Copy link

I'm having the same problem as SooLee above, on RHEL, but it's a shared machine and I can't manually install gmp-devel. Is there another workaround? Basically, any time I try to do something with stack, it fails because ld "cannot find -lgmp". This is odd, because gmp is definitely installed, and if I run stack with --verbose, it actually finds gmp:

...
2019-07-12 09:54:46.791604: [debug] Run process: /sbin/ldconfig -p
2019-07-12 09:54:46.793562: [debug] Process finished in 2ms: /sbin/ldconfig -p
2019-07-12 09:54:46.793734: [debug] Found shared library libtinfo.so.5 in 'ldconfig -p' output
2019-07-12 09:54:46.794100: [debug] Did not find shared library libtinfo.so.6
2019-07-12 09:54:46.794206: [debug] Did not find shared library libncursesw.so.6
2019-07-12 09:54:46.795012: [debug] Did not find shared library libgmp.so.10
2019-07-12 09:54:46.795106: [debug] Found shared library libgmp.so.3 in 'ldconfig -p' output
2019-07-12 09:54:46.795159: [debug] Potential GHC builds: gmp4
2019-07-12 09:54:46.795227: [debug] Found already installed GHC builds: gmp4
...

@borsboom
Copy link
Contributor

@EasyArray I believe this is answered in #4956 (comment).

@cad0p
Copy link

cad0p commented Feb 15, 2022

Oh I see the problem. We need to limit the sanity check to the global database only. Can you test if actually using this new GHC via stack build succeeds? I think it should.

On Fri, Jul 3, 2015, 10:38 AM Peter Harpending notifications@github.com wrote:

On Fri, Jul 03, 2015 at 04:20:16AM -0700, Michael Snoyman wrote:

That's quite unexpected, I haven't seen anything like that before. What
happens if you run:
/home/pete/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc-pkg list

A big list of packages. Many of them are colored red:
http://ix.io/jrN. Note the advisory about broken packages.
When I run /home/pete/.stack/.../ghc-pkg check, this is the output:
http://ix.io/jrO.
Peter Harpending

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

Same issue, fails setup but succeeds build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants