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

Paths_* modules cannot be found #82

Closed
mrkkrp opened this issue Jan 12, 2018 · 11 comments
Closed

Paths_* modules cannot be found #82

mrkkrp opened this issue Jan 12, 2018 · 11 comments

Comments

@mrkkrp
Copy link
Contributor

mrkkrp commented Jan 12, 2018

As you probably know there is a way to get version of package we're building by importing a special auto-generated module that is prefixed with Paths_. For example, I have a project called mmark-cli and so I would like to write the following:

module Main (main) where

import Paths_mmark_cli (version)

main :: IO ()
main = return ()

This succeeds with stack build but Flycheck reports an error:

Could not find module ‘Paths_mmark_cli’
Use -v to see a list of the files searched for.

Which is very unfortunate. Maybe this could be fixed somehow?

@mrkkrp
Copy link
Contributor Author

mrkkrp commented Jan 12, 2018

The auto-generated module is located at .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/mmark/autogen where mmark is the name of component (executable), mmark-cli is the name of package.

@mrkkrp
Copy link
Contributor Author

mrkkrp commented Jan 12, 2018

It looks like the difference is in the presence of executable name:

Included by Flycheck: .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/autogen
Needs to be included: .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/mmark/autogen
                                                                               ^^^^^

@mrkkrp
Copy link
Contributor Author

mrkkrp commented Jan 12, 2018

I'm also getting:

Suspicious state from syntax checker haskell-stack-ghc: Flycheck checker haskell-stack-ghc returned non-zero exit code 1, but its output contained no errors: cc1: fatal error: cabal_macros.h: No such file or directory
compilation terminated.
`gcc' failed in phase `C pre-processor'. (Exit code: 1)

when I try to use CPP, namely the Cabal-generated definitions such as VERSION_my_package. I think the culprit may be the same.

@gahag
Copy link

gahag commented Jan 20, 2018

I'm also having this. The same issue happens with stack ghci, it can't find the Paths_* module. I believe it is related to this issue in stack/cabal: commercialhaskell/stack#3791

@gahag
Copy link

gahag commented Jan 20, 2018

I got rid of the issue, both in stack ghci and in flycheck, by changing the stack resolver from lts-10.3 to lts-9.21. It looks like the cause is a breaking change in the new cabal version.
I've also installed the flycheck-haskell package in emacs while attempting to solve the issue. Not sure if it's related.

@sergv
Copy link
Contributor

sergv commented Jan 20, 2018 via email

@sergv
Copy link
Contributor

sergv commented Jan 22, 2018

@mrkkrp @gahag I would apreciate if you could give my PR a spin and confirm that it works for you.

@sergv
Copy link
Contributor

sergv commented Jan 25, 2018

Should be fixed now. Please reopen if that's not the case.

@sergv sergv closed this as completed Jan 25, 2018
@mrkkrp
Copy link
Contributor Author

mrkkrp commented Apr 11, 2018

I'm experiencing this again. Now I'm on NixOS though. Anything I can do to help debug this?

@sergv
Copy link
Contributor

sergv commented Apr 15, 2018 via email

@mrkkrp
Copy link
Contributor Author

mrkkrp commented Apr 16, 2018

Huh, it looks like I can't reproduce it anymore. If I run into this again, I'll provide the info you requested!

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

3 participants