【发布时间】:2014-10-04 01:36:37
【问题描述】:
我想要的是:cabal 来构建我的模块; make 构建这个脚本。
脚本链接到 Objective-C(参见 https://github.com/mchakravarty/language-c-inline/tree/master/tests/objc/marshal-array)。当我构建脚本时,导入失败:
$ 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
这里是一些文件内容:
$ 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
...
如果我只是将所有内容放在同一个目录中,而忽略 cabal,则 cabal 构建成功,可执行文件编译并运行成功。
我可以告诉 GHC 某个模块是某个包的一部分吗?
我可以使用这些外部依赖项制作 cabal 可执行文件吗?
还有其他解决方案吗?
【问题讨论】: