While trying to run a nix-shell with the RPostgres R package installed, I hit a build failure because libpq cannot be found. My shell.nix:
{ pkgs ? import <nixpkgs> {} }:
let
rEnv = pkgs.rWrapper.override { packages = with pkgs.rPackages; [ RPostgres ]; };
in with pkgs; mkShell { buildInputs = [ postgresql rEnv ]; }
Running nix-shell
yields this error:
building '/nix/store/8ckwmk5ws5l94mzmqxf3xm6081alz69s-r-RPostgres-1.1.1.drv'...
...
* installing *source* package 'RPostgres' ...
** package 'RPostgres' successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
Using PKG_LIBS=-lpq
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libpq was not found. Try installing:
* deb: libpq-dev (Debian, Ubuntu, etc)
* rpm: postgresql-devel (Fedora, EPEL)
* rpm: postgreql8-devel, psstgresql92-devel, postgresql93-devel, or postgresql94-devel (Amazon Linux)
* csw: postgresql_dev (Solaris)
* brew: libpq (OSX)
If libpq is already installed, check that either:
(i) 'pkg-config' is in your PATH AND PKG_CONFIG_PATH contains
a libpq.pc file; or
(ii) 'pg_config' is in your PATH.
I’ve tried adding postgresql.lib
, pkg-config
, and libpqxx
(only because I didn’t find a libpq
package) to my buildInputs
, both individually and in combination, but none made any difference.
I created an issue a few days ago, but thought I’d check here in case anyone knows how I might resolve or work around the problem. It’s much appreciated!