Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPostgres rPackage error #46208

Closed
ivanbrennan opened this issue Sep 6, 2018 · 14 comments · Fixed by #46445
Closed

RPostgres rPackage error #46208

ivanbrennan opened this issue Sep 6, 2018 · 14 comments · Fixed by #46445

Comments

@ivanbrennan
Copy link
Member

ivanbrennan commented Sep 6, 2018

Issue description

The compilation of RPostgres rPackage fails.

Steps to reproduce

Create a shell.nix:

{ pkgs ? import <nixpkgs> {} }:

let
  rEnv = pkgs.rWrapper.override {
    packages = with pkgs.rPackages; [ RPostgres ];
  };

in with pkgs; mkShell {
  buildInputs = [ postgresql rEnv ];
}

and run nix-shell.

Result:

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 tried adding postgresql.lib, pkg-config, and libpqxx (only because I didn't find a libpq package) to the buildInputs (individually and in combination), but none made any difference.

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.15.0-33-generic, Ubuntu, 18.04.1 LTS (Bionic Beaver)
  • multi-user?: no
  • sandbox: no
  • version: nix-env (Nix) 2.0
  • channels(ivan): "nixos-18.09pre143771.a8c71037e04, nixpkgs-18.09pre145919.adbd3ead271"
  • nixpkgs: /home/ivan/.nix-defexpr/channels/nixpkgs
@ryantm
Copy link
Member

ryantm commented Sep 9, 2018

Trying to reproduce, I got a different issue:

$ nix-shell -I nixpkgs=/home/ryantm/p/nixpkgs -p pkgs.rPackages.RPostgres                                                                                                 
these derivations will be built:                                                                                                                                                               
  /nix/store/9f9s3shhccfwq02k0splzwmf4awzrs8i-r-RPostgres-1.0-4.drv                                                                                                                            
building '/nix/store/9f9s3shhccfwq02k0splzwmf4awzrs8i-r-RPostgres-1.0-4.drv'...                                                                                                                
unpacking sources                                                                                                                                                                              
unpacking source archive /nix/store/i0i46w7nvbvyxm7kpiacrfqwnp863j3y-RPostgres_1.0-4.tar.gz                                                                                                    
source root is RPostgres                                                                                                                                                                       
setting SOURCE_DATE_EPOCH to timestamp 1513785056 of file RPostgres/MD5                                                                                                                        
patching sources                                                                                                                                                                               
configuring                                                                                                                                                                                    
building                                                                                                                                                                                       
running tests                                                                                                                                                                                  
installing                                                                                                                                                                                     
* installing *source* package 'RPostgres' ...                                                                                                                                                  
** package 'RPostgres' successfully unpacked and MD5 sums checked                                                                                                                              
sh: ./configure: /bin/bash: bad interpreter: No such file or directory                                                                                                                         
ERROR: configuration failed for package 'RPostgres'                                                                                                                                            
* removing '/nix/store/1kcb2fipcp2jsdlj4wbk9p99ddv5r2rg-r-RPostgres-1.0-4/library/RPostgres'                                                                                                   
builder for '/nix/store/9f9s3shhccfwq02k0splzwmf4awzrs8i-r-RPostgres-1.0-4.drv' failed with exit code 1                                                                                        
error: build of '/nix/store/9f9s3shhccfwq02k0splzwmf4awzrs8i-r-RPostgres-1.0-4.drv' failed

cc @peti

@ryantm
Copy link
Member

ryantm commented Sep 9, 2018

I made a PR to fix it. It builds after this PR. I don't really know how to test it.

@ivanbrennan
Copy link
Member Author

Thanks @ryantm
I'm not sure why we ran into different errors, but I was able to successfully build using your fix.

@ryantm
Copy link
Member

ryantm commented Sep 10, 2018

@ivanbrennan you were probably building on a system where /bin/bash exists

@ivanbrennan
Copy link
Member Author

@ryantm You're exactly right. I was on an Ubuntu system.

@logantalley
Copy link

logantalley commented Aug 12, 2021

@ryantm I am running into the issue that the merge was supposed to fix. I see that it patches 'configure' and then it complains that the MD5 checksum for 'configure' failed.

building '/nix/store/qkd83fp2b0jw9ba0d73a6p43wkcncyhl-r-RPostgres-1.2.1.drv'...
unpacking sources
unpacking source archive /nix/store/9wz0mzci8l3yhdb9yrd6hz0hpy7gaqwb-RPostgres_1.2.1.tar.gz
source root is RPostgres
setting SOURCE_DATE_EPOCH to timestamp 1601291402 of file RPostgres/MD5
patching sources
configuring
patching script interpreter paths in configure
configure: interpreter directive changed from "#!/bin/sh" to "/nix/store/xvvgw9sb8wk6d2c0j3ybn7sll67s3s4z-bash-4.4-p23/bin/sh"
building
running tests
installing
* installing *source* package 'RPostgres' ...
file 'configure' has the wrong MD5 checksum
** using staged installation
./configure: line 2: /bin/bash: No such file or directory
Warning in system(cmd) : error in running command
ERROR: configuration failed for package 'RPostgres'
* removing '/nix/store/6xmpxxnl030wqbp0glvvd5ar8gv8zh7f-r-RPostgres-1.2.1/library/RPostgres'
builder for '/nix/store/qkd83fp2b0jw9ba0d73a6p43wkcncyhl-r-RPostgres-1.2.1.drv' failed with exit code 1
error: build of '/nix/store/qkd83fp2b0jw9ba0d73a6p43wkcncyhl-r-RPostgres-1.2.1.drv' failed

@ryantm
Copy link
Member

ryantm commented Aug 12, 2021

@logantalley Could you please say what command you are running and provide information about the system running it (OS, version of nix, etc.)?

@logantalley
Copy link

logantalley commented Aug 12, 2021

@ryantm Yes, my apologies. Running on NixOS 21.05. The command I used was:
nix-shell r-test.nix

r-test.nix contains the following:

with import <nixpkgs> {};

pkgs.mkShell {
  buildInputs = with pkgs; [
    R
    rPackages.glue
    rPackages.RPostgres 
  ];
}

@ryantm
Copy link
Member

ryantm commented Aug 12, 2021

@logantalley I cannot reproduce this. I took the latest master commit and ran this and it worked:

$ nix --version
nix (Nix) 2.4pre20210601_5985b8b
$ NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/c87557a817a.tar.gz nix-shell r-test.nix

@logantalley
Copy link

logantalley commented Aug 12, 2021

Output of nix --version for me is:
nix (Nix) 2.3.15

Edit: OK I ran the exact command that you did at the end there, and it does work. So it looks like the fix does not apply for nix v2.3.15, but will work for 2.4+ at least, and maybe some versions between 2.3.15 and 2.4

@logantalley
Copy link

So the latest stable version of nix is 2.3.15. So this package doesn't work on stable, you have to specify a newer version, right? What happens if you try using the stable version of nix?

I just did a sudo nix-channel --update and a sudo nixos-rebuild switch and I still can't build RPostgres on stable.

@ryantm
Copy link
Member

ryantm commented Aug 12, 2021

Yeah, I don't think it has to do with the version of nix. I can reproduce your error with the latest version of release-21.05.

NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/ad6e733d633802620b5eec9be91e837973eac18a.tar.gz nix-shell testr.nix

@logantalley
Copy link

Ah I see. OK so this a NixOS issue, not a nixpkgs issue. Thank you very much for your help.

@ryantm
Copy link
Member

ryantm commented Aug 12, 2021

This can be simplified to:

nix-build https://github.com/nixos/nixpkgs/archive/ad6e733d633802620b5eec9be91e837973eac18a.tar.gz -A rPackages.RPostgres fails and
nix-build https://github.com/nixos/nixpkgs/archive/master.tar.gz -A rPackages.RPostgres works

I'm asking on Matrix if people have a suggestion for what happend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants