atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or misconfigured. ENOENT #81

Closed pavanetti closed 8 years ago

pavanetti commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.3.2 System: linux 4.3.3-2-ARCH Thrown From: haskell-ghc-mod package, v1.4.1

Stack Trace

Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or misconfigured. ENOENT

At Error: spawnSync ghc-mod ENOENT
PATH: /usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
path: undefined
Path: undefined

Error: spawnSync ghc-mod ENOENT
    at exports._errnoException (util.js:837:11)
    at Object.spawnSync (child_process.js:432:20)
    at new GhcModiProcess (/home/carlos/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process.coffee:24:14)
    at Object.module.exports.HaskellGhcMod.activate (/home/carlos/.atom/packages/haskell-ghc-mod/lib/haskell-ghc-mod.coffee:84:18)
    at Package.module.exports.Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:170:19)
    at /usr/share/atom/resources/app.asar/src/package.js:150:32
    at Package.module.exports.Package.measure (/usr/share/atom/resources/app.asar/src/package.js:92:15)
    at /usr/share/atom/resources/app.asar/src/package.js:143:26
    at Package.module.exports.Package.activate (/usr/share/atom/resources/app.asar/src/package.js:140:34)
    at PackageManager.module.exports.PackageManager.activatePackage (/usr/share/atom/resources/app.asar/src/package-manager.js:517:21)
    at /usr/share/atom/resources/app.asar/src/package-manager.js:499:29
    at Config.module.exports.Config.transactAsync (/usr/share/atom/resources/app.asar/src/config.js:337:18)
    at PackageManager.module.exports.PackageManager.activatePackages (/usr/share/atom/resources/app.asar/src/package-manager.js:494:19)
    at PackageManager.module.exports.PackageManager.activate (/usr/share/atom/resources/app.asar/src/package-manager.js:478:46)
    at AtomEnvironment.module.exports.AtomEnvironment.startEditorWindow (/usr/share/atom/resources/app.asar/src/atom-environment.js:686:21)
    at module.exports (/usr/share/atom/resources/app.asar/src/initialize-application-window.js:28:10)
    at setupWindow (file:///usr/share/atom/resources/app.asar/static/index.js:86:5)
    at window.onload (file:///usr/share/atom/resources/app.asar/static/index.js:41:9)

Commands

Config

{
  "core": {}
}

Installed Packages

# User
emmet, v2.3.17
haskell-ghc-mod, v1.4.1
ide-haskell-cabal, v1.0.0
linter-lua, v1.0.1
love-launcher, v0.5.0

# Dev
No dev packages
lierdakil commented 8 years ago

@carlos-pavanetti please see https://github.com/atom-haskell/haskell-ghc-mod#configuration

hwroitzsch commented 8 years ago

@lierdakil Can you please explain in more detail?

The description on that linked website tells me I need to add ghc-mod to my PATH somehow. In .bashrc? I installed haskell-ghc-mod using apm, however, I have no idea what path to add to my PATH now.

lierdakil commented 8 years ago

See https://github.com/atom-haskell/haskell-ghc-mod/blob/master/README.md#dependencies

It's package readme file btw. 24 янв. 2016 г. 3:40 пользователь "hwroitzsch" notifications@github.com написал:

@lierdakil https://github.com/lierdakil Can you please explain in more detail?

The description on that linked website tells me I need to add ghc-mod to my PATH somehow. In .bashrc? I installed haskell-ghc-mod using apm, however, I have no idea what path to add to my PATH now.

— Reply to this email directly or view it on GitHub https://github.com/atom-haskell/haskell-ghc-mod/issues/81#issuecomment-174238817 .

Addibro commented 8 years ago

Hi there, I'm a noob to both mac and haskell so you might get frustrated! So, how should one install this haskell mod in a step to step way? I installed all required packages for IDE in ATOM itself, but I guess I have to configure some things in terminal, with which I'm not very confident handling (like setting up PATH and all that). Thanks a bunch for any help.

Thank you

hwroitzsch commented 8 years ago

@Addibro I resorted to using stack instead:

http://docs.haskellstack.org/en/stable/README.html

You basically do the following:

  1. download the program from there, which is appropriate for your OS
  2. In your .bashrc file: add the program's directory to PATH like this: PATH=$PATH:/your/directory/here/
  3. In your .bashrc file: add eval "$(stack --bash-completion-script stack)"
  4. open a new terminal or logout and login to be sure the .bashrc file is read.
  5. go to a directory where you want to create a new environment for the Haskell compiler and packages
  6. Run the following:
    • stack new env_name
    • cd env_name
    • stack setup
    • stack build
  7. now you can try the interactive mode with stack ghci in that directory.

This was written from memory, could be that I forgot a step.

Addibro commented 8 years ago

@hwroitzsch Hi and thanks for replying. So you work completely in terminal instead of Atom then?

hwroitzsch commented 8 years ago

@Addibro For stack usage yes, completely in the terminal. I am not aware of any Atom packages, which enable one to do these steps from inside Atom, but there might be some. I prefer to work on the command line for doing such things, as I don't have to rely on the correctness of any packages of Atom this way.

However, the Haskell packages for Atom I installed using Atom's GUI. There are a few and you could also install them with the apm command on command line.

lierdakil commented 8 years ago

@Addibro, what OS are you on?

In any case, you need Haskell Platform installed. Then you can do this (from terminal):

mkdir ghc-mod
cd ghc-mod
cabal sandbox init --sandbox=.
cabal update
cabal install ghc-mod

This will install ghc-mod into ghc-mod/bin. If you ever need to update ghc-mod, you just remove ghc-mod directory and repeat those steps. This takes care of dependencies. Remember the directory that you installed ghc-mod into.

Now for setup.

You need to either specify full path to ghc-mod executable in haskell-ghc-mod settings, specifically in 'Ghc Mod Path' (e.g. .../ghc-mod/bin/ghc-mod), or add path to .../ghc-mod/bin to 'Additional Path Directories'. To open haskell-ghc-mod settings, in Atom open 'Edit' -> 'Preferences', select 'Packages', find `haskell-ghc-mod', and click 'Settings' (or package name).

Please note that on Atom 1.4.0 and up, there is a bug (https://github.com/atom/atom/issues/10426) which prevents settings from showing up unless package is activated, and it only activates on Haskell files. Sorry, can't do much about it on my end :(

If you're on OSX, there exists some PATH weirdness with Atom, so I suggest you start it from terminal to save some headache. If you want to start it from Finder, read on.

You will need to add your shell PATH to 'Additional Path Directories' setting in haskell-ghc-mod package settings, and to ide-haskell-cabal settings (select relevant GHC version as active, and paste your shell PATH as 'Path for GHC 7.X').

To get shell PATH, run echo $PATH from terminal. Note, that you need to replace : (semicolons) with , (commas) when adding to 'Additional Path Directories'. Not the case with 'Path for GHC 7.X'.

I know all this is somewhat awkward. Sorry. Didn't notice some of this until recently (since ide-haskell-cabal wasn't written by me). As soon as I have some substantial free time, I will try to pull my crap together and make this whole thing easier.