给定目录

时间:2015-10-14 16:03:46

标签: postgresql haskell haskell-stack

我正在尝试设置一个使用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.libC:\PostgreSQL\8.4\lib个文件。

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

更新

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

首先,我已将C:\PostgreSQL\8.4\bin添加到我的PATH中。据我所知,这可以按预期工作,因为我错过了pg_config错过的错误,以及我目前的错误。

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

我还应该提一下我的Postgres安装工作正常。

2 个答案:

答案 0 :(得分:1)

我知道Snowdrift项目使用PostgreSQL并在Windows上使用Stack构建。他们的网站上有a build guide。看起来有一点不同就是他们提到:

  

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

您可以尝试将其添加到PATH并查看是否可以修复它吗?

答案 1 :(得分:1)

某种版本不匹配。

安装Postgres 9.4而不是8.4允许以我尝试的方式构建getMaxAge()包。

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

幸运的是,使用haskell和针对Postgres 9.4库构建的postgresql-simple没有问题与我的远程' (virtualbox)数据库是Postgres 8.4。

我很想把我的问题标记为没有建设性,除非其他人发现这个有用的信息。