我已经建立了一个项目,该项目使用PostgreSQL支持,并且使用Servant和Persistent。当我运行stack ghci
时,一切正常,包括迁移,但是当我运行stack build
时,出现以下错误:
Linking .stack-work\dist\29cc6475\build\ServantAuthTraining-exe\ServantAuthTraining-exe.exe ...
C://Users//Chris//AppData//Local//Programs//stack//x86_64-windows//ghc-8.8.3//mingw//bin/ld.exe: cannot find -llibpq
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)
-- While building package ServantAuthTraining-0.1.0.0 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 build lib:ServantAuthTraining exe:ServantAuthTraining-exe --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
我在Windows上,对所有提到的技术都是新手。
我可以通过pgAdmin连接到数据库。
您可能需要将类似--extra-include-dirs=C:\PostgreSQL\8.4\include --extra-lib-dirs=C:\PostgreSQL\8.4\lib
(或任何路径)的内容传递给stack
,以便它知道在何处可以找到libpq
。也可以按照stack.yaml
中的说明在https://docs.haskellstack.org/en/latest/yaml_configuration/#extra-include-dirsextra-lib-dirs中进行配置。