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

non-zero exit code 1, but no errors from output #2

Closed
pakanek opened this issue Feb 11, 2014 · 15 comments
Closed

non-zero exit code 1, but no errors from output #2

pakanek opened this issue Feb 11, 2014 · 15 comments

Comments

@pakanek
Copy link

pakanek commented Feb 11, 2014

Hello,

I am getting this error:

Checker haskell-hdevtools returned non-zero exit code 1, but no errors from output: Glyph.hs:44:18:
    Could not find module `Graphics.Rendering.FreeType.Internal.GlyphMetrics'
    Use -v to see a list of the files searched for.

Checker definition probably flawed.

Package is in cabal sandbox. I've used

$ cabal sandbox delete
$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal configure && cabal build

Program compiles and works fine.

flycheck-version: 0.18alpha (package: 20140210.1331)

$ emacs --version
GNU Emacs 24.3.1
...
$ cabal --version
cabal-install version 1.18.0.2
using version 1.18.1.2 of the Cabal library 
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3

Output of C-c ! C-c:

-*- mode: compilation; default-directory: "~/code/haskell/bdf/" -*-
Compilation started at Tue Feb 11 16:50:38

hdevtools check -g -Wall /home/$USER/code/haskell/bdf/RepaImg.hs
Glyph.hs:44:18:
    Could not find module `Graphics.Rendering.FreeType.Internal.GlyphMetrics'
    Use -v to see a list of the files searched for.

Compilation exited abnormally with code 1 at Tue Feb 11 16:50:38

If I open Glyph.hs file, flycheck highlights error on line 44 (the one with qualified keyword) which is same as the output from C-c ! C-c:

...
import Graphics.Rendering.FreeType.Internal.GlyphMetrics (FT_Glyph_Metrics)
import qualified Graphics.Rendering.FreeType.Internal.GlyphMetrics as GlyphMetrics
...

In other files of my project I am getting the non-zero exit code 1 listed above.

Full contents of *Messages* buffer:

Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/git-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/golang-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/haskell-mode-init.el (source)...
Loading haskell-site-file...done
Loading /usr/share/emacs/site-lisp/site-start.d/haskell-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/systemtap-init.el (source)...done
OVERVIEW
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Updating buffer list...
Formats have changed, recompiling...done
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Initializing...done
Loading names...done
Checker haskell-hdevtools returned non-zero exit code 1, but no errors from output: Glyph.hs:44:18:
    Could not find module `Graphics.Rendering.FreeType.Internal.GlyphMetrics'
    Use -v to see a list of the files searched for.

Checker definition probably flawed.
Checker haskell-hdevtools returned non-zero exit code 1, but no errors from output: Glyph.hs:44:18:
    Could not find module `Graphics.Rendering.FreeType.Internal.GlyphMetrics'
    Use -v to see a list of the files searched for.

Checker definition probably flawed.
Compilation exited abnormally with code 1
Mark set
Quit
byte-code: Beginning of buffer [4 times]
Auto-saving...
Checker haskell-hdevtools returned non-zero exit code 1, but no errors from output: Glyph.hs:44:18:
    Could not find module `Graphics.Rendering.FreeType.Internal.GlyphMetrics'
    Use -v to see a list of the files searched for.

Checker definition probably flawed.
Auto-saving...
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
@pakanek
Copy link
Author

pakanek commented Feb 11, 2014

If I remove any import statement for Graphics.Rendering.FreeType then I get same error on last import statement of this package.

@pakanek
Copy link
Author

pakanek commented Feb 12, 2014

As I understand this is related to the fact that hdevtools is unaware of cabal projects or sandboxes so this issue can be closed.
bitc/hdevtools#6
bitc/hdevtools#4

@purcell
Copy link
Member

purcell commented Feb 13, 2014

Aha, right -- thanks for following up on this.

The core flycheck ghc checker takes some steps to set the include path etc. using the project's cabal config, so it's likely I need to update this checker to use some of the same inferred info.

@pakanek
Copy link
Author

pakanek commented Feb 14, 2014

There are some of my notes. As noted on hdevtools issue tracker flags for ghci should work for hdevtools using -g option. Here is my example:
Flags needed to load my main.hs with ghci:

ghci -hide-all-packages \
        -package base \
        -package filepath \
        -package directory \ 
        -package mtl \
        -package-db \
        .cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d/ \
        -package freetype2 \
        -package bytestring \
        -package gtk \
        main.hs

Contents of cabal file:

...
build-type:          Simple
cabal-version:       >=1.10
executable bdf
  main-is:             main.hs
  build-depends:       base ==4.6.*, repa, repa-devil, gtk, freetype2, mtl, filepath, directory, bytestring
  default-language:    Haskell2010

Imports in main.hs:

import Graphics.UI.Gtk
import Graphics.UI.Gtk.Builder
import Glyph
import Control.Monad.Error
import Data.List
import Data.Word
import System.Directory
import System.FilePath

And these are same flags used for ghci which also works for hdevtools:

hdevtools check -g -hide-all-packages -g "-package base" -g "-package filepath" -g "-package directory" -g "-package mtl" -g "-package-db .cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d/" -g "-package freetype2" -g "-package bytestring" -g "-package gtk" main.hs

So most basic thing to do would be:
1 check for presence of sandbox
2 determine directory with sandbox pkg database ($ARCH-$SYSTEM-$COMPILER-$VERSION)
3 query cabal configuration for build-depends
4 update hdevtools flags

There is interesting package cabal-ghci (deprecated in favour of cabal-install) which is supposed to setup ghci for cabal project so maybe it would be possible to get appropriate flags directly from cabal (library or cabal-install).

I am not sure if cabal support should be moved into hdevtools itself so people using other editors would benefit from it too.

@purcell
Copy link
Member

purcell commented Feb 14, 2014

I can't comment on whether hdevtools itself should get cabal support, but see my previous comment re. this particular issue: the flycheck-haskell package can already set the flags for Flycheck's ghc checker using Cabal information.

What's needed here is to use those same flags when constructing the flycheck-hdevtools checker's command line. There's a DSL for that in flycheck, but it doesn't seem easy to use it to create "wrapped" args as in your example above. Perhaps @lunaryorn can suggest an easy way to do that.

@swsnr
Copy link
Contributor

swsnr commented Feb 14, 2014

@purcell You can always use the eval form to construct arbitrary arguments with custom Lisp code.

@purcell
Copy link
Member

purcell commented Feb 14, 2014

@lunaryorn Yes, I figured that out, but I didn't want to reproduce the code for the option-list and option-flag forms if I could avoid it. Will investigate further.

@swsnr
Copy link
Contributor

swsnr commented Feb 14, 2014

@purcell There's not a lot of code behind these forms, and you can still call flycheck-substitute-argument explicitly.

@purcell
Copy link
Member

purcell commented Feb 14, 2014

Yes, I might do the latter. Thanks!

@purcell
Copy link
Member

purcell commented Mar 8, 2014

With any luck, hdevtools itself is about to get Cabal sandbox support: bitc/hdevtools#30

If that gets merged, I won't plan to make any changes to flycheck-hdevtools.

@gridaphobe
Copy link
Contributor

In the meantime, I've been using this adapted version of the ghc checker for hdevtools. It works pretty well for me if anyone wants to steal it.

@purcell
Copy link
Member

purcell commented Jul 11, 2014

@gridaphobe Aha, perhaps I should just paste that directly into flycheck-hdevtools...

@purcell
Copy link
Member

purcell commented Jul 11, 2014

@gridaphobe Done... I've committed those changes with you as the author. Thanks!

@gridaphobe
Copy link
Contributor

Hehe, glad to help :)

On Friday, July 11, 2014, Steve Purcell [email protected] wrote:

@gridaphobe https://github.com/gridaphobe Done... I've committed those
changes with you as the author. Thanks!


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

Sent from Gmail Mobile

@swsnr
Copy link
Contributor

swsnr commented Jan 15, 2016

Closing due to the lack of activity.

@swsnr swsnr closed this as completed Jan 15, 2016
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

4 participants