“所请求的模块与接口文件”中找到的名称不同“ [英] "requested module differs from name found in the interface file"
问题描述
我想要的是: cabal
来构建我的模块; make
来构建这个脚本。
脚本链接到Objective-C(参见 https://github.com/mchakravarty/language-c-inline/tree /主/测试/ objc /编组阵列)。当我构建脚本时,它在导入时失败:
$ $ $ $ $ $ $ Main.hs:1:1:
错误的接口文件:dist / build / Commands / OSX / Events.hi
有些问题;请求的模块main:Commands.OSX.Events不同于在接口文件命令中找到的名称-.0.0:Commands.OSX.Events
这里有一些文件内容:
$ cat Makefile
PACKAGES = -package template- haskell -package language-c-quote -package language -c-inline -package命令
FRAMEWORKS = -framework Carbon -framework Cocoa -framework Foundation
LDFLAGS = $(PACKAGES)$(FRAMEWORKS)
Main:o
cabal exec - ghc -o Main Main.o $(LDFLAGS)
Main.o:
cabal build
cabal exec - ghc -c Main.hs -idist / build / -v
...
$ cat commands.cabal
exposed-modules:Commands.OSX.Events
hs-source -dirs:sources
...
$ ghc --show-iface dist / build / Commands / OSX / Events.hi
interface commands-0.0.0:Commands。 OSX.Events 7083
...
$ cat sources / Commands / OSX / Events.hs
module Commands.OSX.Events where
...
$ cat Main.hs
import Commands.OSX.Events
...
cabal构建成功,并且可执行文件编译并运行成功,如果我只是把所有内容放在同一目录下,并忽略cabal。
-
我可以告诉GHC一些模块是一些软件包的一部分吗?
-
我可以使用这些外部依赖软件创建一个cabal可执行文件吗?
-
其他任何解决方案
- 模块包工作:
ghc -package-name commands-0.0.0
http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/packages.html
What I want is:
cabal
to build my modules;make
to build this one script.The script links to Objective-C (see https://github.com/mchakravarty/language-c-inline/tree/master/tests/objc/marshal-array). when I build the script, it fails on the import:
$ make Main.hs:1:1: Bad interface file: dist/build/Commands/OSX/Events.hi Something is amiss; requested module main:Commands.OSX.Events differs from name found in the interface file commands-0.0.0:Commands.OSX.Events
here are some file contents:
$ cat Makefile PACKAGES = -package template-haskell -package language-c-quote -package language-c-inline -package commands FRAMEWORKS = -framework Carbon -framework Cocoa -framework Foundation LDFLAGS = $(PACKAGES) $(FRAMEWORKS) Main: Main.o cabal exec -- ghc -o Main Main.o $(LDFLAGS) Main.o: cabal build cabal exec -- ghc -c Main.hs -idist/build/ -v ... $ cat commands.cabal exposed-modules: Commands.OSX.Events hs-source-dirs: sources ... $ ghc --show-iface dist/build/Commands/OSX/Events.hi interface commands-0.0.0:Commands.OSX.Events 7083 ... $ cat sources/Commands/OSX/Events.hs module Commands.OSX.Events where ... $ cat Main.hs import Commands.OSX.Events ...
the cabal build is successful, and executable compiles and runs successfully, if I just put everything in the same directory, and ignore cabal.
can I tell GHC that some module is part of some package?
can I make a cabal executable, with these external dependencies?
any other solutions?
解决方案explicitly naming the modules package worked:
ghc -package-name commands-0.0.0
http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/packages.html
这篇关于“所请求的模块与接口文件”中找到的名称不同“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!