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

Upstream Mac M1 Stack issue causing run-haskell to fail for Stack projects #1794

Open
dapritchard opened this issue Nov 11, 2022 · 0 comments

Comments

@dapritchard
Copy link

When I run run-haskell for a Stack project I'm seemingly getting many segmentation faults, followed by a GHCi prompt for a GHCi session that wasn't invoked for with the correct command-line arguments.

The text in the *haskell* buffer resulting from a call to run-haskell looks something like the following (there are dozens of segmentation fault messages that are left out). Note that GHCi isn't loaded with a particular package component, even though one was specified via the haskell-process-args-stack-ghci variable in the buffer from which run-haskell was invoked.

Process haskell segmentation fault: 11

<many more segmentation fault messages omitted>

Process haskell segmentation fault: 11

* * * * * * * *
It isn't yet possible to load multiple packages into GHCi in all cases - see
https://ghc.haskell.org/trac/ghc/ticket/10827
* * * * * * * *

Configuring GHCi with the following packages: using-quickcheck, validating-numbers-into-words
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help

I'm an M1 Mac user, and what I believe is causing the problem is an upstream Stack issue that affects M1 Macs as described in this Stack GitHub issue. For example, if I run

(make-comint "haskell" "stack" nil "ghci" "using-quickcheck")

then I get a single reported Process haskell segmentation fault: 11. But if I run

(make-comint "haskell" "bash" nil "-c" "stack ghci using-quickcheck")

then things work as expected.

As a workaround I'm currently using a modified version of inferior-haskell-start-process to run GHCi through Stack as follows.

(defun inferior-haskell-start-process--stack-workaround ()
  "Mimics `inferior-haskell-start-process' but using a workaround to get Stack to work."
  (let* ((command (haskell-program-name-with-args))
         (args-string (mapconcat #'shell-quote-argument command " ")))
    (when inferior-haskell-root-dir
      (setq default-directory inferior-haskell-root-dir))
    (setq inferior-haskell-buffer
          (make-comint "haskell" "bash" nil "-c" args-string))
    (with-current-buffer inferior-haskell-buffer
      (inferior-haskell-mode)
      (run-hooks 'inferior-haskell-hook))))
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

1 participant