haskell makefile导入库

haskell makefile import library

所以我有以下生成文件,我想用它来编译我的 haskell 程序。但是,在我的 program.hs 文件中,我导入了一个不在标准 Haskell 发行版中的库(例如 Data.List)。结果,当我尝试编译时,出现以下错误。我怎样才能包含上述库以便编译正常? P.S。我 NOT 对不涉及 makefile 的其他方法感兴趣,谢谢。

错误:

Linking program...
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

生成文件:

 program: program.hs
        ghc --make -static -optl-static program.hs

你走错了静态选项的道路。我假设你在 os-x。正如 ld: library not found for -lcrt0.o on OSX 10.6 with gcc/clang -static flag 中所解释的那样,这只会让事情变得更糟。事实上你得到了一个不同的错误,因为你得到了一个 earlier 错误。

要写一个好的makefile,首先确保你可以运行 ghc 编译程序而无需 make,只需运行ning 中的命令shell.

即尝试只编译 ghc --make program.hs 看看会发生什么。如果您的包环境中已经有其他库,那么它们是否在标准发行版中并不重要。