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

haskell-process-cabal-build doesn't build under certain conditions #285

Closed
psibi opened this issue Jun 13, 2014 · 24 comments
Closed

haskell-process-cabal-build doesn't build under certain conditions #285

psibi opened this issue Jun 13, 2014 · 24 comments

Comments

@psibi
Copy link
Contributor

psibi commented Jun 13, 2014

In haskell-mode, when I do cabal build using haskell-process-cabal-build, I get this:

Complete: cabal build (0 compiler messages)

But in the haskell-process-log, I see this:

-> ":!cd /home/sibi/snapshot-analysis/ && cabal build
"
<- "/bin/sh: 1: cabal: not found

I don't get how it's not able to see my cabal path. In fact, I have these things in my emacs configuration, just to be sure:

(setq exec-path (cons "~/.cabal/bin" exec-path))

(setenv "PATH"
  (concat
   "~/.cabal/bin/" ":"
   (getenv "PATH")
  )
)

The cabal which I have is inside ~/.cabal/bin. Let me know if you need any other details.

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

Everything works fine, if I switch over to terminal and run the usual cabal build command.

@chrisdone
Copy link
Member

This is an FAQ. Let me find the link.

@chrisdone
Copy link
Member

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

@chrisdone As already mentioned in the original thread, I have set the PATH as stated in the FAQ. The cabal initially works within the mode but after some time, it doesn't.

@psibi psibi changed the title haskell-process-cabal-build doesn't buid under certain conditions haskell-process-cabal-build doesn't build under certain conditions Jun 13, 2014
@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

Just to add extra information, I have set the process-type as cabal-repl.

When I do the C-c-l from the haskell source code, it works. When I do C-c-c from the cabal file, it gives out the above error that it's not able to find cabal.

@chrisdone
Copy link
Member

Does M-! cabal work? Also try in the REPL typing :!echo $PATH to see what's up.

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

λ> :!echo $PATH
~/.cabal/bin/:/home/sibi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:.cabal-sandbox/bin/

I'm not sure what do you mean by M-! cabal. If you meant this: M-x cabal, then I'm not able to find any elisp function named cabal in my environment. In fact, If I run cabal build in M-x compile, emacs recognizes the cabal path and executes it.

@chrisdone
Copy link
Member

I meant M-! cabal. I.e. type the keys M-! then type cabal then type RET.

@tobiasgwaaler
Copy link

M-! is usually bound to shell-command, so it would try to run cabal from a shell

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

M-! produces this:

cabal: no command given (try --help)

@ivan-m
Copy link
Contributor

ivan-m commented Jun 13, 2014

Try using $HOME instead of ~ for your PATH (actually, you'll probably need to use getenv to get the HOME variable); my guess is that it's a problem with shell expansion.

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

@ivan-m Tried both $HOME and the exact path, but that doesn't seem to solve the problem.

@chrisdone
Copy link
Member

Very strange. Oh! Do M-! which cabal. Perhaps cabal is coming from somewhere else?

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

Ok, it starts working after I put the complete path like this: /home/user/.cabal/bin

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

M-! which cabal throws error message:

(Shell command failed with code 1 and no output) [2 times]

On bash, it gives:

/home/sibi/.cabal/bin//cabal

The doule // I think is not good and I have no clue how that got setup.

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

@chrisdone Shall I close the issue ?

And maybe we can update the FAQ to try this in case everything else fails.

@ivan-m
Copy link
Contributor

ivan-m commented Jun 13, 2014

The // shouldn't matter.

Can you do (for example) M-! which emacs just to make sure that's working?

@chrisdone
Copy link
Member

Maybe be a fix: #282 But the PATH stuff is still a worry.

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

@ivan-m Restarted the emacs and tried it again to receive the same error:

(Shell command failed with code 1 and no output)

Just curious why // doesn't matter ?

@ivan-m
Copy link
Contributor

ivan-m commented Jun 13, 2014

Well, I've never seen // make a difference in a path in bash at least.

But that error makes it look like the problem might be with your emacs or emacs config. Can you try it with emacs -Q?

@psibi
Copy link
Contributor Author

psibi commented Jun 13, 2014

@ivan-m Thanks, will try this and report that once I go to my office again. (~ after 2 days).

@psibi
Copy link
Contributor Author

psibi commented Jun 19, 2014

@ivan-m Now it gives proper path when I use M-! (when started with and without -Q in emacs).

@gracjan
Copy link
Contributor

gracjan commented Feb 26, 2015

@psibi: Is this PATH issue working for you?

@gracjan
Copy link
Contributor

gracjan commented Mar 27, 2015

Do not hessitate to write a note here if this PATH issue is still bothering you.

@gracjan gracjan closed this as completed Mar 27, 2015
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

5 participants