0

我正在尝试建立一个使用该postgresql-simple包的堆栈项目。尝试安装时,安装stack build的所有依赖项都postgresql-simple没有问题,但堆栈自身安装时遇到问题postgresql-simple。我收到以下错误:

C:project> stack build --extra-include-dirs="C:\PostgreSQL\8.4\include" --extra-lib-dirs="C:\PostgreSQL\8.4\lib"

... omitted ...

*****************
--extra-include-dirs=C:\PostgreSQL\8.4\include
*****************
--extra-include-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\include 
--extra-include-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include 
*****************
--extra-lib-dirs=C:\PostgreSQL\8.4\lib
***************************** 
--extra-lib-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\lib 
--extra-lib-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\User\Desktop\draftkings\NFAccuracy\.stack-work\logs\postgresql-libpq-0.9.1.1.log

Configuring postgresql-libpq-0.9.1.1...
Setup.hs: Missing dependency on a foreign library:
* Missing C library: pq
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.

我也试过在我的stack.yaml文件中指定路径,同样的错误。

我尝试手动复制库并将文件从我的 postgres 安装包含到提到的...\mingw64\lib文件...\mingw64\include夹中。同样的错误。

我有文件libpq.dll并且libpq.lib在我的C:\PostgreSQL\8.4\lib文件夹中。

我觉得我错过了一些明显的东西,但我无法让它工作,我不确定我做错了什么。任何帮助表示赞赏。

更新

我忘了提到两个重要的细节。

首先,我已添加C:\PostgreSQL\8.4\bin到我的 PATH 中。据我所知,这可以按预期工作,因为我已经解决了一个关于pg_config丢失的错误,而是我目前遇到的错误。

其次,我还尝试将libandinclude目录添加到我的 PATH 中,但这并没有改变错误。

我还应该提到我的 Postgres 安装本身就可以正常工作。

4

2 回答 2

1

我知道 Snowdrift 项目使用 PostgreSQL 并在 Windows 上使用 Stack 构建。他们的网站上有一个构建指南。看起来一个区别是他们提到:

将 PostgreSQL bin 目录添加到路径中C:\Program Files (x86)\PostgreSQL\9.4\bin

您可以尝试将其添加到 PATH 中,看看是否可以修复它?

于 2015-10-15T04:35:57.367 回答
1

存在某种版本不匹配。

安装 Postgres 9.4 而不是 8.4 允许postgresql-simple以我尝试的方式构建包。

我的堆栈项目,在没有我干预的情况下,默认使用resolver: 'lts-3.7'这个为我的项目提供0.4.10.0的包版本。postgresql-simple我希望我有一个更详细的答案,但我只能说这个版本postgresql-simple(它是相当新的)适用于 PostgreSQL 9.4(它也是最近的)。

幸运的是,使用 Haskell 并postgresql-simple针对 Postgres 9.4 库构建在与我的 Postgres 8.4 的“远程”(虚拟盒)数据库通信时没有问题。

除非其他人发现此有用信息,否则我很想将我的问题标记为不具建设性。

于 2015-10-23T05:56:56.587 回答