Open cderv opened 6 years ago
I'm confirming that UDUNITS2_INCLUDE
does not work - the configure script fail to locate the files in:
export UDUNITS2_INCLUDE=/usr/include/udunits2
ls -l "$UDUNITS2_INCLUDE"
total 76
drwxr-xr-x. 2 root root 60 Jan 31 2019 .
drwxr-xr-x. 114 root root 16384 Mar 27 04:17 ..
-rw-r--r--. 1 root root 5895 Dec 8 2015 converter.h
-rw-r--r--. 1 root root 39992 Dec 8 2015 udunits2.h
-rw-r--r--. 1 root root 5195 Dec 8 2015 udunits.h
This is a show stopper for large-scale software stack installation on CentOS.
The same applies on macOS when setting UDUNITS2_INCLUDE=/usr/local/Cellar/udunits/2.2.27.6/include
.
@jameshiebert, is there any chance you could get this fixed (I see there are PRs addressing this) and roll out a new version on CRAN? It would be of great value to the community and lots of sysadms out there. Many people struggle and spend lots of time trying to figure this out and those hours add up quickly. The strong dependency comes in from the sf package via units.
Apparently there is a typo in the env var name which the package shows during installation error. One needs to append an "S", so "UDUNITS2_LIBS" instead of "UDUNITS2_LIB".
In addition, if you are on macOS 10.15 you might need to append -I/usr/local/include
to your CPPFLAGS
var in ~/.R/Makevars
.
This helps {udunits2} find the "include" dir automatically.
I put some time in to compare the Makevars files of the {units} package with the one of {udunits2} and did some tests but was not successful in getting it auto-linked.
I've found no other way than specifying the env var so that linking works.
This package has not seen an update since 2016 - it might be a time fix some things up. The package will most likely never error on CRAN because it has no tests. Maybe {units} has some options to drop it and include the binding to udunits2 in some other way.
install.packages("udunits2", type = "source")
#> Installing package into '/Users/pjs/Library/R/4.0/library'
#> (as 'lib' is unspecified)
#> Warning in install.packages("udunits2", type = "source"): installation of
#> package 'udunits2' had non-zero exit status
# works
Sys.setenv("UDUNITS2_LIBS" = "/usr/local/lib")
install.packages("udunits2", type = "source")
#> Installing package into '/Users/pjs/Library/R/4.0/library'
#> (as 'lib' is unspecified)
Created on 2020-04-15 by the reprex package (v0.3.0)
Workaround for CentOS 7 users:
If you have 'libudunits2-devel' installed (*) on your system, then you can install the udunits2 package from CRAN as:
> install.packages("udunits2", configure.args="--with-udunits2-include=/usr/include/udunits2")
(*) To check whether you have the 'libudunits2-devel' library installed on the system, first check that you have the run-time 'libudunits2' library installed as:
$ ldconfig -p | grep libudunits2
libudunits2.so.0 (libc6,x86-64) => /lib64/libudunits2.so.0
libudunits2.so (libc6,x86-64) => /lib64/libudunits2.so
Then, check that you have the 'libudunits2-devel' library installed by verifying that you have the include files (which are needed to build and install the R package but not to run it):
$ ls -l /usr/include/udunits2
total 56
-rw-r--r--. 1 root root 5895 Dec 8 2015 converter.h
-rw-r--r--. 1 root root 39992 Dec 8 2015 udunits2.h
-rw-r--r--. 1 root root 5195 Dec 8 2015 udunits.h
The above assumes that the above have been installed as yum install libudunits2-devel
by you or the sysadms. If you don't have admin rights, then you have to ask the sysadmin to install that library.
@jameshiebert, any progress on submit the fixed version to CRAN?
This is related to #14 , that should have been fixed by #19.
I can't install the package if
udunits2
is not inside the/usr/include
directory. The header file is in/usr/include/udunits
that thanks to #19, it should be searched in. However,install.packages("udunits2")
fails with this errorIt works if I use
install.packages("udunits2",configure.args='--with-udunits2-include=/usr/include/udunits2/')
but it does not work if I use environment variable UDUNITS2_INCLUDEI have tried few ways to configure environment variable, and I can't make it to work. Also,
/usr/include/udunits2
should have searched https://github.com/pacificclimate/Rudunits2/blob/282e73289f0df23ae80e1dcb03a881c2be74725e/configure.ac#L13-L23Is this working for someone ? Should I dig deeper on what is going on ?
Thank you for your advice.
For the context, I need to work with environment variable for a use case with
packrat
that cannot handle optionconfigure.args='--with-udunits2-include=/usr/include/udunits2/'