NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.51k stars 13.69k forks source link

R package rgdal fails to build #34343

Closed idontgetoutmuch closed 6 years ago

idontgetoutmuch commented 6 years ago

Issue description

error: build of ‘/nix/store/jk0rqmkm333pfiajrjvgd1ylfz4vf9yd-r-rxgdal-1.2-16.drv’ failed

In more detail

bash-3.2$ bash-3.2$ nix-shell . -I nixpkgs=/Users/dom/nixpkgs
these derivations will be built:
  /nix/store/jk0rqmkm333pfiajrjvgd1ylfz4vf9yd-r-rgdal-1.2-16.drv
building path(s) ‘/nix/store/0vn5702llamiw9h0w8g8izdd1na4vs50-r-rgdal-1.2-16’
unpacking sources
unpacking source archive /nix/store/hmlpfphlllxw12m3rz5hr7748xhp64ac-rgdal_1.2-16.tar.gz
source root is rgdal
setting SOURCE_DATE_EPOCH to timestamp 1511308544 of file rgdal/MD5
patching sources
configuring
building
running tests
installing
* installing *source* package 'rgdal' ...
** package 'rgdal' successfully unpacked and MD5 sums checked
configure: CC: clang
configure: CXX: clang++
configure: rgdal: 1.2-16
checking for /usr/bin/svnversion... yes
./configure: line 1733: svnversion: command not found
configure: svn revision: 701
checking for gdal-config... /nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.2.3
checking GDAL version >= 1.6.3... yes
checking gdal: linking with --libs only... yes
checking GDAL: /nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/share/gdal/pcs.csv readable... yes
configure: -g -O2  -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include
checking proj_api.h presence and usability... yes
dyld: Library not loaded: /nix/store/wbbxlsnyp1vpwj7rp9d0l0m4d4z425gl-mariadb-connector-c-2.3.4/lib/libmariadb.2.dylib
  Referenced from: /nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/lib/libgdal.20.dylib
  Reason: image not found
checking PROJ.4 version: ... ./configure: line 2030: test: -eq: unary operator expected
./configure: line 2035: test: -ge: unary operator expected
< 4.8.0
./configure: line 2063: test: -ge: unary operator expected
proj_conf_test2.c:3:7: error: conflicting types for 'pj_open_lib'
FILE *pj_open_lib(const char *, const char *);
      ^
/nix/store/l060rjvms9wbmnzvngjsrjbwg33c4kyr-proj-4.9.3/include/proj_api.h:169:8: note: previous declaration is here
PAFile pj_open_lib(projCtx, const char *, const char *);
       ^
proj_conf_test2.c:7:34: error: too few arguments to function call, expected 3, have 2
    fp = pj_open_lib("epsg", "rb");
         ~~~~~~~~~~~             ^
/nix/store/l060rjvms9wbmnzvngjsrjbwg33c4kyr-proj-4.9.3/include/proj_api.h:169:1: note: 'pj_open_lib' declared here
PAFile pj_open_lib(projCtx, const char *, const char *);
^
2 errors generated.
./configure: line 2110: ./proj_conf_test2: No such file or directory
checking PROJ.4: epsg found and readable... yes
./configure: line 2138: test: -ge: unary operator expected
proj_conf_test3.c:3:7: error: conflicting types for 'pj_open_lib'
FILE *pj_open_lib(const char *, const char *);
      ^
/nix/store/l060rjvms9wbmnzvngjsrjbwg33c4kyr-proj-4.9.3/include/proj_api.h:169:8: note: previous declaration is here
PAFile pj_open_lib(projCtx, const char *, const char *);
       ^
proj_conf_test3.c:7:35: error: too few arguments to function call, expected 3, have 2
    fp = pj_open_lib("conus", "rb");
         ~~~~~~~~~~~              ^
/nix/store/l060rjvms9wbmnzvngjsrjbwg33c4kyr-proj-4.9.3/include/proj_api.h:169:1: note: 'pj_open_lib' declared here
PAFile pj_open_lib(projCtx, const char *, const char *);
^
2 errors generated.
./configure: line 2185: ./proj_conf_test3: No such file or directory
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags:  -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include
configure: Package LIBS:  -L/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c OGR_write.cpp -o OGR_write.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c gdal-bindings.cpp -o gdal-bindings.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/cc -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2  -c init.c -o init.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/cc -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2  -c inverser.c -o inverser.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/cc -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2  -c local_stubs.c -o local_stubs.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c ogr_geom.cpp -o ogr_geom.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/cc -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2  -c ogr_polygons.c -o ogr_polygons.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c ogr_proj.cpp -o ogr_proj.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c ogrdrivers.cpp -o ogrdrivers.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c ogrsource.cpp -o ogrsource.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -I/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/include -DNDEBUG -I/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/include -I"/nix/store/ylk7gqpr4hyvkfmh8ymzf8gjpzvndkxr-r-sp-1.2-5/library/sp/include"    -fPIC  -g -O2 -c projectit.cpp -o projectit.o
/nix/store/cslvigh4a1656g9z9j1ndvzalx7v2s4k-clang-wrapper-4.0.1/bin/c++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/lib -o rgdal.so OGR_write.o gdal-bindings.o init.o inverser.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/lib -lgdal -lproj -L/nix/store/vxni3jvvpz6xy0cd3w7gz0wjz61fymnx-R-3.4.3/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
installing to /nix/store/0vn5702llamiw9h0w8g8izdd1na4vs50-r-rgdal-1.2-16/library/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for 'rgdal' in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/nix/store/0vn5702llamiw9h0w8g8izdd1na4vs50-r-rgdal-1.2-16/library/rgdal/libs/rgdal.so':
  dlopen(/nix/store/0vn5702llamiw9h0w8g8izdd1na4vs50-r-rgdal-1.2-16/library/rgdal/libs/rgdal.so, 6): Library not loaded: /nix/store/wbbxlsnyp1vpwj7rp9d0l0m4d4z425gl-mariadb-connector-c-2.3.4/lib/libmariadb.2.dylib
  Referenced from: /nix/store/2ci05xq0q9h86yqfg99g2jdvynkcfjm3-gdal-2.2.3/lib/libgdal.20.dylib
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/nix/store/0vn5702llamiw9h0w8g8izdd1na4vs50-r-rgdal-1.2-16/library/rgdal'
builder for ‘/nix/store/jk0rqmkm333pfiajrjvgd1ylfz4vf9yd-r-rgdal-1.2-16.drv’ failed with exit code 1
error: build of ‘/nix/store/jk0rqmkm333pfiajrjvgd1ylfz4vf9yd-r-rxgdal-1.2-16.drv’ failed
/nix/var/nix/profiles/default/bin/nix-shell: failed to build all dependencies

Steps to reproduce

With this default.nix

let
  pkgs = import <nixpkgs> {};
  stdenv = pkgs.stdenv;
in with pkgs; {
  myProject = stdenv.mkDerivation {
    name = "myProject";
    version = "1";
    src = if pkgs.lib.inNixShell then null else nix;

    buildInputs = with rPackages; [
      R
      ggplot2
      dplyr
      maps
      Cairo
      knitr
      rgdal
    ];
  };
}

run nix-shell . -I nixpkgs=/Users/dom/nixpkgs

Technical details

bash-3.2$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 17.3.0, macOS 10.13.2`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 1.11.15`
 - channels(root): `"nixpkgs-18.03pre122117.14df60d0db9"`
 - channels(dom): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
idontgetoutmuch commented 6 years ago

This https://github.com/NixOS/nixpkgs/pull/34345 works for me.