简体   繁体   English

GHC找不到模块,但GHCi可以找到

[英]GHC could not find module but GHCi can

I have previously installed the tidal package with cabl install tidal 我之前已使用cabl install tidal安装了tidal软件包

When running ghc Tidal.hs : 当运行ghc Tidal.hs

Tidal.hs:4:1: error:
    Could not find module ‘Sound.Tidal.Context’
    There are files missing in the ‘tidal-0.9.6’ package,
    try running 'ghc-pkg check'.
    Locations searched:
      Sound/Tidal/Context.hs
      Sound/Tidal/Context.lhs
      Sound/Tidal/Context.hsig
      Sound/Tidal/Context.lhsig
      /home/chris/.cabal/lib/x86_64-linux-ghc-8.2.2/tidal-0.9.6-HlQOMGZHP8JDJBhFqbDzA/Sound/Tidal/Context.hi
  |
4 | import Sound.Tidal.Context

Within the last filepath that file indeed does not exist but there are files named that end in .dyn_hi . 在最后一个文件路径中,该文件确实不存在,但是存在以.dyn_hi结尾的.dyn_hi So the full path to the file that does exist is: /home/chris/.cabal/lib/x86_64-linux-ghc-8.2.2/tidal-0.9.6-HlQOMGZHP8JDJBhFqbDzA/Sound/Tidal/Context.dyn_hi 因此,存在的文件的完整路径为: /home/chris/.cabal/lib/x86_64-linux-ghc-8.2.2/tidal-0.9.6-HlQOMGZHP8JDJBhFqbDzA/Sound/Tidal/Context.dyn_hi

What may be the cause of the error? 错误原因可能是什么? I am able to import the module successfully within ghci . 我可以在ghci成功导入模块。

I read through this: https://ghc.haskell.org/trac/ghc/wiki/DynamicLinkingDebate 我阅读了以下内容: https : //ghc.haskell.org/trac/ghc/wiki/DynamicLinkingDebate

Running it with the -dynamic flag appears to fix it: ghc -dynamic Tidal.hs . 与运行它-dynamic标记看起来修复: ghc -dynamic Tidal.hs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM