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

Segmentation Fault from ghci #2228

Closed
carymrobbins opened this issue Jun 2, 2016 · 8 comments
Closed

Segmentation Fault from ghci #2228

carymrobbins opened this issue Jun 2, 2016 · 8 comments

Comments

@carymrobbins
Copy link

It's highly likely that this is a bug with ghc, but figured I'd start here.

When running ghc --interactive (or ghci) from the command line via stack, it seems that passing a package specified in the extra-deps of stack.yaml produces a segmentation fault -

$ stack ghc -- --interactive -package hakyll-sass                      
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
[1]    9839 segmentation fault (core dumped)  stack ghc -- --interactive -package hakyll-sass

Attempting to pass the full package name, including the @ suffix, doesn't seem to work either -

$ stack ghc -- --interactive -hide-all-packages -package base
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
λ :m Hakyll.Web.Sass

<no location info>:
    Could not find module ‘Hakyll.Web.Sass’
    It is a member of the hidden package ‘hakyll-sass-0.2.0@hakyl_1urYnSdaNKvBiW7ovUv5av’.
λ 
Leaving GHCi.

$ stack ghc -- --interactive -package 'hakyll-sass-0.2.0@hakyl_1urYnSdaNKvBiW7ovUv5av'
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
<command line>: Can't parse package flag: hakyll-sass-0.2.0@hakyl_1urYnSdaNKvBiW7ovUv5av

Here's the full repo - https://github.com/carymrobbins/carymrobbins.github.io/tree/hakyll

For context, I'm attempting to dynamically pass the package flags so that I can easily load different "cabal configs" (e.g. library, executable, test-suite, benchmark) in ghci for some tooling I'm working on. Not pertinent, but should clear up why I'm even doing this in the first place.

@carymrobbins
Copy link
Author

Almost forgot to mention versions -

$ lsb_release -d    
Description:    Ubuntu 14.04.3 LTS

$ stack --version                                            
Version 0.1.9.0, Git revision a4fdeaee25c9cb5fd8d28dd76e97747ab88d4dc0 (2679 commits) x86_64

$ stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

@mgsloan
Copy link
Contributor

mgsloan commented Jun 2, 2016

That's a somewhat old-ish version of stack, I suggest updating!

You will probably like the stack ghci :my-test-suite. After you've built your project once it works really well with stack ghci --no-build :my-test-suite. To load both the library and the test-suite together, do stack ghci my-pkg :my-test-suite. To omit the initial load of all modules, pass --no-load. Really gotta document this better - #1896 - stack ghci is really important for my daily development.

@mgsloan mgsloan added this to the Support milestone Jun 2, 2016
@carymrobbins
Copy link
Author

Does the Ubuntu 14.04 apt repo have a newer version?

$ cat /etc/apt/sources.list.d/fpco.list
deb http://download.fpcomplete.com/ubuntu trusty main

Thanks for letting me know that stack ghci now accepts cabal configs. That may be something I'll be able to leverage.

Any ideas why ghci would segfault for this?

@mgsloan
Copy link
Contributor

mgsloan commented Jun 2, 2016

Use stack upgrade to get the latest stable.

Any ideas why ghci would segfault for this?

Noidea. I'd say that a segmentation fault is always a bug.

@carymrobbins
Copy link
Author

Wow, stack upgrade is nice!

FWIW, even after upgrading stack I still seem to have the same issue -

$ stack --version
Version 1.1.2 x86_64 hpack-0.14.0

$ stack ghc -- --interactive -package hakyll-sass 
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
[1]    974 segmentation fault (core dumped)  stack ghc -- --interactive -package hakyll-sass

@mgsloan
Copy link
Contributor

mgsloan commented Jun 7, 2016

Could be a corrupt ghc. One of the nice things about stack is that it verifies these downloads!

We should probably default to using a stack managed ghc ( #2221 ), but till then, what happens if you put system-ghc: false in your global config? This will force you to use stack setup if the ghc was not installed by stack.

@carymrobbins
Copy link
Author

Doesn't seem to make a difference -

$ cat ~/.stack/global/stack.yaml 
flags: {}
packages: []
extra-deps: []
resolver: lts-3.4
system-ghc: false
$ cat stack.yaml 
resolver: lts-5.0

packages:
- '.'

extra-deps: [
  hakyll-sass-0.2.0
]

flags: {}

extra-package-dbs: []
$ stack setup
stack will use a locally installed GHC
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

$ stack ghc -- --interactive -package hakyll-sass 
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
[1]    1527 segmentation fault (core dumped)  stack ghc -- --interactive -package hakyll-sass

$ stack exec -- which ghc
/home/crobbins/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc

@mgsloan
Copy link
Contributor

mgsloan commented Oct 18, 2016

Closing, as this is an old support ticket. It'd be great to figure out what's going on here, but it doesn't seem to be a common issue.

@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