Installation of 'sf' package had non-zero exit status, CentOS7 (on cluster)

I am using R on a shared cluster, which uses CentOS7.

I only have issues with installing this specific package, "sf" (simple features).

I have tried a solution I found online -(install.packages - pass configure arguments to install packages in R - Stack Overflow) but it still ran the same error.

I also asked the program administrator for our university's cluster, and he reassured that udunits2 is already installed in this library (/usr/include/udunits2/).

install.packages('sf',configure.args=c(sf="--with-udunits2-include=/usr/include/udunits2")
...
Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  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.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.

Maybe you could check that you can access udunits

system("ls -l /usr/include/udunits2.h")

Thanks Etienne, I've checked and I can access it but I'm still not able to install "sf" because of the udunits2 error.

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

I would try with

install.packages('sf',configure.args="--with-udunits2-include=/usr/include/udunits2")

or

install.packages('sf',configure.args=list(sf="--with-udunits2-include=/usr/include/udunits2"))

Hi Marek,

Thank you! I had tried your suggestions, unfortunately I still get the same error.

Well, I had same problem and I have local .Rprofile file where I set up:

options(
	configure.args = list(
	    udunits2 = "--with-udunits2-include=/usr/include/udunits2"
	)	
)

which works for me (argument to install.packages is not needed then).

In your case maybe you need second arg:

install.packages( 'sf', configure.args="--with-udunits2-include=/usr/include/udunits2 --with-udunits2-lib=/usr/local/lib")

as message states.