r-quantities / units

Measurement units for R
https://r-quantities.github.io/units
175 stars 28 forks source link

units not working due to missing udunits C libraries #1

Closed dantonnoriega closed 6 years ago

dantonnoriega commented 8 years ago

The package units depends on the packages udunits2. However, while the udunits2 package seems to successfully install after running install.packages('udunits2'), it doesn't actually work out-of-the-box. You can see this when you try to install it from from source.

I received the following error when I tried to install udunits2 from source...

> install.packages('udunits2', type = 'source')

[OMITTED]

-----Error: libudunits2 not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.
ERROR: configuration failed for package ‘udunits2’
-----Error: libudunits2 not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.
ERROR: configuration failed for package ‘udunits2’

Hence, what we need are these libraries.

Here is how I solved it on my mac using Homebrew.

  1. In your Terminal.app, do the following:
brew install udunits

While I used Homebrew, it appears you can download the libraries here. I did not do it this way, but I'm assuming that if you do this successfully, then you should be able to do steps 2 and 3.

  1. Once installed, go to R and install udunits2 from source...
install.packages('udunits2', type = 'source', repo = 'cran.rstudio.com')
  1. Install units (I installed the development version).
devtools::install_github('edzer/units', type = 'source')

Or

install.packages('units', type = 'source')

DONE

jameshiebert commented 8 years ago

it doesn't actually work out-of-the-box

To be fair, the udunits2 R package does specifically declare a SystemRequirements which, by definition, has to be dealt with outside of the R packaging environment.

edzer commented 8 years ago

The problem is that this is left to the user, and many R users don't know what to do. Add a README.md to the Rudunits2 project, link from here? Where can windows binaries of udunits be found?

krlmlr commented 8 years ago

It may be just easiest to bundle libudunits2 with the udunits2 package. The rwinlib project offers quite a few libraries bundled for Windows, but I haven't found udunits2 there -- CC @gaborcsardi @jeroenooms.

jeroen commented 8 years ago

Why would windows users need to install from source? install.packages('udunits2') does work out of the box?

krlmlr commented 8 years ago

Oh, it does on my system, too. @ultinomics mentioned that "t doesn't actually work out-of-the-box"...

jeroen commented 8 years ago

I have added windows builds on rwinlib/udunits and also created a PR on the R package which automatically uses these builds when building the package from source on Windows: https://github.com/pacificclimate/Rudunits2/pull/7

edzer commented 8 years ago

This is because on windows CRAN packages, external dependencies (SysRequirements) are linked statically to the shared library in the package. It seems this is also the case on mac -- @ultinomics installed from source. Thanks for the pointer to rwinlib!

ginolhac commented 7 years ago

just for the record, on mac and to complete the nice @ultinomics's answer after installing udunits withbrew install udunits, I needed this to successfully compile:

install.packages('udunits2', type = 'source', repo = 'cran.rstudio.com', configure.args = "--with-udunits2-lib=/usr/local/Cellar/udunits/2.2.20/lib/")
elbamos commented 7 years ago

Is there a prospect for a near-term resolution of this? I'd like to add to my package a dependency on ggforce, which depends on units 0.4, but then the udunits issue breaks my travis builds.

edzer commented 7 years ago

Not sure if I understand your issue: have you seen this? Or are you trying a MacOSX flavor of travis?

elbamos commented 7 years ago

Yes, and both osx and linux.

Compare this: https://travis-ci.org/elbamos/largeVis/jobs/183274802 (OSX build works), with this https://travis-ci.org/elbamos/largeVis/jobs/183274804 (everything identical but using R-devel, build fails).

(A similar issue may be arising with Ubuntu and 64-bit builds, but I'm not yet sufficiently confident in the issue to report it. I'll know tonight.)

edzer commented 7 years ago

Well, it's your call that you want to do a macosx travis for r-devel, for which cran does not have binaries available: it means that you'll have to install udunits2 for this platform from source too. Although that is no problem at all in itself, IMHO you're overdoing your eagerness to check everything you can with this target: is it worth the effort?

elbamos commented 7 years ago

Hah! Well, cran requires it, and I've had so many issues of compilation problems on different platforms (my package makes extensive use of c++11, openmp, 64-but libraries etc.), that I feel a need to be thorough. I'm also checking with valgrind... id much rather find out from cran than get a moderately judgmental email from the cran maintainers.

Not sure I understand why this would require a different installation of udunits. I'm installing the library with brew and the R package from source in both cases.

On Dec 12, 2016, at 11:07 AM, Edzer Pebesma notifications@github.com wrote:

Well, it's your call that you want to do a macosx travis for r-devel, for which cran does not have binaries available: it means that you'll have to install udunits2 for this platform from source too. Although that is no problem at all in itself, IMHO you're overdoing your eagerness to check everything you can with this target: is it worth the effort?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

edzer commented 7 years ago

No, CRAN requires you test with r-devel, it doesn't specify on which platform. CRAN binary packages for MacOSX come with statically linked libraries, meaning the udunits2 C library is part of the udunits2 R package, and ignored by the R package. I don't think that your first travis build mentioned above installs source packages: extension .tgz indicates binary MacOSX packages, source pkgs have .tar.gz extension.

jeroen commented 7 years ago

There are no CRAN binary package for r-devel so on these targets you need to build from source and hence need to ensure that the system dependencies are available. Just add a line:

brew_packages: udunits

to the osx/r-devel entry in your travis build matrix.

elbamos commented 7 years ago

I have the brew line in there already for all OS X builds - it's still throwing that error.

On Dec 12, 2016, at 11:22 AM, Jeroen Ooms notifications@github.com wrote:

There are no CRAN binary package for r-devel so on these targets you need to build from source and hence need to ensure that the system dependencies are available. Just add a line brew_packages: udunits to the osx/r-devel entry in your travis build matrix.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

edzer commented 7 years ago

The error messages you see on the travis output, as well as the message in this issue just above your first one here are all pretty full with instructions on how to solve this. Also, your issue is really with udunits2, not with this package.

wdkrnls commented 7 years ago

I'm trying to install this package and am it's failing, telling me udunits2.h not found despite it actually being there. Do you have a dependency on that specific version of udunits2?

checking for unistd.h... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... yes
-----Error: udunits2.h not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.

I tried to install it with:

install.packages("units", 
                  configure.args = c("--with-udunits2-include=/usr/include/udunits2", 
                                     "--with-udunits2-lib=/usr/lib64"), 
                  type = "source")

Although, I also set the suggested UDUNITS2_INCLUDE, UDUNITS2_LIB, and UDUNITS2_XML_PATH environment variables as well, just in case.

I installed the udunits2 development RPM package on CentOS6.6. It is version 2.1.19.

edzer commented 7 years ago

Package units doesn't need udunits2.h, so I think that your problem is with installing udunits2, rather than with units, am I right? See here for a place to raise issues on that.

wdkrnls commented 7 years ago

Thanks, Edzer. Applying the same configure.args to that package let me install.

josiekre commented 7 years ago

I just spent half a day on this! Thanks @ginolhac for the solution. It would be nice to see this somewhere on the sfr package README after brew install udunits.

Yuanchao-Xu commented 7 years ago

ggforce is also one of my dependencies and I met with the same problem, solved by adding one line in .travis.yml file

apt_packages: libudunits2-dev

the same issue has also been discussed here

kendonB commented 7 years ago

For those users who are working on a cluster and don't have root access, the following worked for me. Hope it helps someone! From within R:

homedir <- Sys.getenv("HOME")
udunits_dir <- file.path(Sys.getenv("HOME"), "udunits")
system(paste0("mkdir ", udunits_dir))
system(paste0("wget --directory-prefix=", udunits_dir, " ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.2.26.tar.gz"))
owd <- getwd()
setwd(udunits_dir)
system("tar xzvf udunits-2.2.26.tar.gz")
setwd(file.path(udunits_dir, "udunits-2.2.26"))
system(paste0("./configure --prefix=", udunits_dir, "/local"))
system("make")
system("make install")
setwd(owd)
Sys.setenv(LD_LIBRARY_PATH=paste0(Sys.getenv("LD_LIBRARY_PATH"), ":", udunits_dir, "/local/lib"))
install.packages("udunits2", 
                 type = "source",
                 configure.args = c(paste0("--with-udunits2-include=", udunits_dir, "/local/include"), 
                                    paste0("--with-udunits2-lib=", udunits_dir, "/local/lib")),
                 repos = "http://cran.rstudio.com")
dyn.load(paste0(udunits_dir, "/local/lib/libudunits2.so.0"))
devtools::install_github("r-quantities/units", 
                         args=paste0("--configure-args=\"--with-udunits2-lib=", udunits_dir, 
                                     "/local/lib --with-udunits2-include=", udunits_dir, "/local/include\""))

You will then need to add:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH":"$HOME"/udunits/local/lib"

to your .bashrc.

sagar-m commented 6 years ago

Thank you for your solution. It worked and I was able to install "udunits2", and "units". However, as you do not mention "ClassInt", installing it, is throwing an error.I have Xcode installed on my mac. Thank you.

`> install.packages('classInt', type = 'source')
trying URL 'https://cran.rstudio.com/src/contrib/classInt_0.1-24.tar.gz'
Content type 'application/x-gzip' length 19194 bytes (18 KB)
==================================================
downloaded 18 KB

* installing *source* package ‘classInt’ ...
** package ‘classInt’ successfully unpacked and MD5 sums checked
** libs
/Users/sherrymukim/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran   -fPIC  -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -I/Users/sherrymukim/anaconda3/include -L/Users/sherrymukim/anaconda3/lib  -c fish1.f -o fish1.o
make: /Users/sherrymukim/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran: No such file or directory
make: *** [fish1.o] Error 1
ERROR: compilation failed for package ‘classInt’
* removing ‘/Users/sherrymukim/anaconda3/lib/R/library/classInt’
Warning in install.packages :
  installation of package ‘classInt’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/p9/6qp4xp2536jdmxd8qkzkhp7m0000gn/T/RtmpENRNpn/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done`
Enchufa2 commented 6 years ago

@sagar-m This has nothing to do with units and @rsbivand has kindly provided in r-spatial/sf#680 several solutions several times already.

jeroen commented 6 years ago

@sagar-m you should be using the recommended R for mac. If you really want to use anaconda you better ask your question over there, this is a problem with their setup.

sagar-m commented 6 years ago

@jeroen that was an excellent suggestion. I do have R for mac, but because I use Anaconda for spyder (python), and they have R studio, thus I was using it. I was able to download sf (binary), and "ClassInt" (source) using R for mac. Thank you very much.

elinw commented 6 years ago

Wanted to mention that on CentOS after doing the yum install install.packages("udunits2",configure.args='--with-udunits2-include=/usr/include/udunits2')

Seems to have worked.

Lulliter commented 6 years ago

I followed instructions of @dantonnoriega (thanks!) and I seem to have succesfully installed units and udunits2 but when I try to use st_distance / starea I continue to get the same error. (I am working with R.3.3 on a mac) Error: In ‘udunits_from_proj[x$units]’, ‘udunits_from_proj’ and ‘x’ are not recognized by udunits. See a table of valid unit symbols and names with valid_udunits(). Add custom user-defined units with install_symbolic_unit()._

Any suggestions on this specific error?

edzer commented 6 years ago

Could you give the output of sessionInfo()?

Lulliter commented 6 years ago

Sure!

sessionInfo() R version 3.3.3 (2017-03-06) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: macOS 10.13.3

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] bindrcpp_0.2 sf_0.5-5 dplyr_0.7.4 units_0.5-1 udunits2_0.13 sp_1.2-7

loaded via a namespace (and not attached): [1] Rcpp_0.12.16 knitr_1.19 bindr_0.1 magrittr_1.5 munsell_0.4.3 colorspace_1.3-2
[7] lattice_0.20-35 R6_2.2.2 rlang_0.2.0.9001 plyr_1.8.4 tools_3.3.3 grid_3.3.3
[13] gtable_0.2.0 e1071_1.6-8 DBI_0.7 class_7.3-14 lazyeval_0.2.1 assertthat_0.2.0
[19] tibble_1.4.2 ggplot2_2.2.1.9000 glue_1.2.0 pillar_1.1.0 scales_0.5.0.9000 classInt_0.1-24
[25] pkgconfig_2.0.1

edzer commented 6 years ago

Please update to the latest sf version, and retry.

Lulliter commented 6 years ago

Thanks, it took a bit but it worked (YAY!).

Here's the trick: My first attempt to update sf failed because of this (same error trying to update rgdal):

configure: error: gdal-config not found or not executable. ERROR: configuration failed for package ‘sf’

Then I followed this suggestion and did (https://stackoverflow.com/questions/34333624/trouble-installing-rgdal/37829420) - in Terminal: brew update brew install gdal

- in R: install.packages("rgdal") install.packages("sf")

and I was able to update both sf and rgdal. Now geoprocessing functions are working.

ArthurDondi commented 6 years ago

Hi, following instructions above in this thread I was able to install udunits2 and udunits2 R package, but not units package. With: install.packages("udunits2", configure.args = "--with-udunits2-lib=/path/to/udunits2/lib --with-udunits2-include=/path/to/udunits2/include")

it works, I got:

checking for unistd.h... yes
checking udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes

and the package gets correctly installed.

But the exact same line with the units package instead of the udunits2 will still get me a udunits2 error:

install.packages("units", configure.args = "--with-udunits2-lib=/path/to/udunits2/lib --with-udunits2-include=/path/to/udunits2/include")

checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc -std=gnu99
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking udunits2/udunits2.h usability... no
checking udunits2/udunits2.h presence... no
checking for udunits2/udunits2.h... no
checking for ut_read_xml in -ludunits2... yes
configure: error: in /tmp/Rtmpy6pWQc/R.INSTALL227932752505/units:
configure: error:
--------------------------------------------------------------------------------
  udunits2.h not found!

  If the udunits2 library is installed in a non-standard location, use:

    --configure-args='--with-udunits2-lib=/usr/local/lib'

  for example, if the library was not found, and/or

    --configure-args='--with-udunits2-include=/usr/include/udunits2'

  if the header was not found, replacing paths with appropriate values for your
  installation. You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIBS
  environment variables.

  If udunits2 is not installed, please install it.
  It is required for this package.

I cannot understand why it does not work with units, the files are present and the paths are correct, otherwise udunit2 R package would not get installed each time I try...

Enchufa2 commented 6 years ago

Can you give us more details?

edzer commented 6 years ago

Thanks, I could reproduce this. With the fix on github, you can install with

> devtools::install_github("r-quantities/units", args='--configure-args="--with-udunits2-lib=/opt/lib --with-udunits2-include=/opt/include"')
ArthurDondi commented 6 years ago

Thanks a lot, it worked!

Just out of curiosity, what was the problem?

edzer commented 6 years ago

this line was missing, so although you'd set the include dir, the test wouldn't use it.

Tazovsky commented 6 years ago

@edzer when version containing this fix will be deployed on CRAN?

edzer commented 6 years ago

I hope within a month.

enricoferrero commented 6 years ago

@edzer I'm still having troubles even with the dev package, any idea on how to fix this? Thanks!

> devtools::install_github("r-quantities/units", args='--configure-args="--with-udunits2-lib=/usr/prog/ati/lib --with-udunits2-include=/usr/prog/ati/include"')
Downloading GitHub repo r-quantities/units@master
from URL https://api.github.com/repos/r-quantities/units/zipball/master
Installing units
'/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/Rtmpd02LWv/devtools1448c1e42389b/r-quantities-units-29ffac2' --library='/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5' --install-tests  \
  --configure-args="--with-udunits2-lib=/usr/prog/ati/lib --with-udunits2-include=/usr/prog/ati/include" 

* installing *source* package ‘units’ ...
configure: units: 0.6-1
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc -std=gnu99
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++  -I"/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/include" -DNDEBUG -I/usr/prog/ati/include -I/usr/prog/ati/include -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/include -I/usr/prog/curl/7.49.1-goolf-1.5.14-NX/include -I/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/include -I"/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/inc... <truncated>
gcc -std=gnu99 -I"/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/include" -DNDEBUG -I/usr/prog/ati/include -I/usr/prog/ati/include -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/include -I/usr/prog/curl/7.49.1-goolf-1.5.14-NX/include -I/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/include -I"/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5... <truncated>
g++  -I"/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/include" -DNDEBUG -I/usr/prog/ati/include -I/usr/prog/ati/include -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/include -I/usr/prog/curl/7.49.1-goolf-1.5.14-NX/include -I/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/include -I"/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/inc... <truncated>
g++ -shared -L/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/lib -L/usr/prog/GCC/4.8.2/lib64 -L/usr/prog/GCC/4.8.2/lib -L/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/lib -L/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/lib -L/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/lib -L/usr/prog/java/1.8.0_20/lib -L/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/lib -L/usr/prog/xz/5.2.2-goolf-1.5.14-NX/lib -L/usr/prog/pcre/8.37-goolf-1.5.14-NX/lib -L/usr/prog/curl/7.49.1-goolf-1.5.14-NX/lib -L/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/lib -o units.so RcppExports.o io.o udunits.o -lexpat -L/usr/prog/ati/lib -lexpat -ludunits2 -L/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/lib -lR
installing to /home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/units/libs
** R
** demo
** inst
** tests
** byte-compile and prepare 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 ‘units’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/units/libs/units.so':
  libudunits2.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/units’
Error: Command failed (1)
edzer commented 6 years ago

This has nothing to do with the units package, but with you wanting to load dynamically linked libraries from a custom path without telling your system. Read into setting the environment variable LD_LIBRARY_PATH, or motify /etc/ld.so.conf and using ldconfig. In this case, starting R with

LD_LIBRARY_PATH=/usr/prog/ati/lib R

may work.

enricoferrero commented 6 years ago

Ah, yes, thank you! LD_LIBRARY_PATH=/usr/prog/ati/lib:$LD_LIBRARY_PATH R followed by devtools::install_github("r-quantities/units", args='--configure-args="--with-udunits2-lib=/usr/prog/ati/lib --with-udunits2-include=/usr/prog/ati/include"') worked.

duoan commented 5 years ago

install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source", configure.args='/usr/local/Cellar/geos/3.7.0/bin/geos-config')

rsbivand commented 5 years ago

@classtag : what does this have to do with anything? The units package does not depend on rgeos in any way. For R-spatial packages in general write to R-sig-geo after subscribing. A guess is that you are misusing configure.args which should include the argument:

'--with-geos-config=<path to geos-config>'