RStudio-Server Community Ed "rgdal" package woes

rstudioserver
package-installation

#1

Hi All,

Sorry, this is my first time posting here so I apologize in advance if I've come to the wrong spot. Please let me know if that is the case. I'm also pretty new to Linux in general, so I'm going to sound pretty clueless here, again my apologies.

I am trying to install a specific package into Rstudio via web IDE but I've run into a series of errors that no amount of googling has been able to solve, but is probably relatively simple for someone with a bit more *nix knowledge than me.

Steps taken below:

From Rstudio web IDE:

install.packages("rgdal")
Installing package into ‘/home/<ORG>/<USER>/R/x86_64-redhat-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL '|-|ttps://cran.rstudio.com/src/contrib/rgdal_1.3-3.tar.gz'
Content type 'unknown' length 1670656 bytes (1.6 MB)
>
downloaded 1.6 MB

installing *source* package ‘rgdal’ ...
package ‘rgdal’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/tmp/RtmpDs3m0S/R.INSTALL76942d4d805/rgdal':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘rgdal’
removing ‘/home/<ORG>/USER>/R/x86_64-redhat-linux-gnu-library/3.3/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/Rtmpe3w5sE/downloaded_packages’

Looking at error message on the 15th line, made me think this was a permissions issue:
"configure: error: C++ compiler cannot create executables"

So I dropped into the console on the server and tried to run the package directly from R as root.
From R over SSH session as root

[root@RSTUDIO-SERVER ~]# R

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

install.packages("rgdal")
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
HTTPS CRAN mirror

 1: 0-Cloud [https]                   2: Algeria [https]
>
Selection: 1
also installing the dependency ‘sp’
>
trying URL '|-|ttps://cloud.r-project.org/src/contrib/sp_1.3-1.tar.gz'
Content type 'unknown' length 1133621 bytes (1.1 MB)
downloaded 1.1 MB
>
trying URL '|-|ttps://cloud.r-project.org/src/contrib/rgdal_1.3-3.tar.gz'
Content type 'unknown' length 1670656 bytes (1.6 MB)
downloaded 1.6 MB

installing *source* package ‘sp’ ...
package ‘sp’ successfully unpacked and MD5 sums checked
libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c Rcentroid.c -o Rcentroid.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c gcdist.c -o gcdist.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c init.c -o init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c pip.c -o pip.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c pip2.c -o pip2.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c sp_xports.c -o sp_xports.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c surfaceArea.c -o surfaceArea.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c zerodist.c -o zerodist.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o sp.so Rcentroid.o gcdist.o init.o pip.o pip2.o sp_xports.o surfaceArea.o zerodist.o -L/usr/lib64/R/lib -lR
collect2: fatal error: cannot find 'ld'
compilation terminated.
make: *** [sp.so] Error 1
ERROR: compilation failed for package ‘sp’
* removing ‘/usr/lib64/R/library/sp’
ERROR: dependency ‘sp’ is not available for package ‘rgdal’
* removing ‘/usr/lib64/R/library/rgdal’

The downloaded source packages are in
        ‘/tmp/RtmpXQjCUX/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages("rgdal") :
  installation of package ‘sp’ had non-zero exit status
2: In install.packages("rgdal") :
  installation of package ‘rgdal’ had non-zero exit status

So the error that I saw that appeared significant here was "collect2: fatal error: cannot find 'ld'".
Would that be a fair assumption or am I way off base?

EDIT: Additional googling has lead me to this page, which explains that ld is a kind of general purpose linker tool that references several libraries and other area's of the file system, so l might be going waaaaaay of base now, sorry.

I started trying to google around for this error and came away with the gist that it was related to a library that my C++ compiler was missing. I used WInSCP to browse the filesystem on the linux machine and found that 'ld' exists in /usr/bin/ld as a symbolic link, but its broken, and returns the following error code when trying to access it (from WinSCP).

No such file or directory.
Error code: 2
Error message from server: No such file

I'm thinking I need to fix that symlink. I used 'readlink' to try and figure out where /usr/bin/ld is pointing to:

[root@RSTUDIO-SERVER ~]# readlink /usr/bin/ld
/etc/alternatives/ld

Looking in /etc/alternatives/ leads me to find out that an ld file or folder is not there, which probably explains my error a few lines up. This is where I get a bit stuck, I've tried reinstalling the gcc package to see if that might fix the link, but no dice. I still trying to get a better idea of what ld does (see EDIT).

I've basically thrown in the towel at this point and come to this forum for help. Anyone feel like having a crack at this for me?

My environment:
Red Hat Enterprise Linux Server release 7.5 (Maipo)
Rstudio-Server Community Ed v1.1.453
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"

Full package list:
https://paste.ee/p/oKb8S


#3

This post was flagged by the community and is temporarily hidden.


#4

You can use yum whatprovides /usr/bin/ld to determine what package is responsible for ld.
I get binutils, so you could try re-installing that package.

FWIW, on the centos7 Docker image I was just playing with:

[root@ec8db6c80948 /]# ls -ls /etc/alternatives/ld
0 lrwxrwxrwx 1 root root 15 Aug  4 22:04 /etc/alternatives/ld -> /usr/bin/ld.bfd
[root@ec8db6c80948 /]# ls -ls /usr/bin/ld*
   0 lrwxrwxrwx 1 root root      20 Aug  4 22:04 /usr/bin/ld -> /etc/alternatives/ld
 984 -rwxr-xr-x 1 root root 1006248 Jun 27 13:26 /usr/bin/ld.bfd
5232 -rwxr-xr-x 1 root root 5354248 Jun 27 13:26 /usr/bin/ld.gold
   8 -rwxr-xr-x 1 root root    5302 Apr 10 07:57 /usr/bin/ldd

#5

Hey Josh, thanks for the reply.

Here's my output from

yum whatprovides /usr/bin/ld

[root@RSTUDIO-SERVER ~]# yum whatprovides /usr/bin/ld
Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
This system is receiving updates from RHN Classic or Red Hat Satellite.
binutils-2.23.52.0.1-16.el7.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.23.52.0.1-30.el7.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.23.52.0.1-30.el7_1.1.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.23.52.0.1-30.el7_1.2.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.23.52.0.1-55.el7.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.25.1-22.base.el7.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.25.1-31.base.el7.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.25.1-32.base.el7_4.1.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.25.1-32.base.el7_4.2.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.27-27.base.el7.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.27-28.base.el7_5.1.x86_64 : A GNU collection of binary utilities
Repo        : rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld



binutils-2.27-28.base.el7_5.1.x86_64 : A GNU collection of binary utilities
Repo        : @rhel-x86_64-server-7
Matched from:
Filename    : /usr/bin/ld

I tried the other commands you posted and found that the first one was a bust, the second showed fairly similiar.

[root@RSTUDIO-SERVER ~]# ls -ls /etc/alternatives/ld
ls: cannot access /etc/alternatives/ld: No such file or directory
[root@RSTUDIO-SERVER ~]# ls -ls /usr/bin/ld*
   0 lrwxrwxrwx. 1 root root      20 Jul 31 03:49 /usr/bin/ld -> /etc/alternatives/ld
 984 -rwxr-xr-x. 1 root root 1006256 May 29 23:00 /usr/bin/ld.bfd
   8 -rwxr-xr-x. 1 root root    5302 Feb  5  2018 /usr/bin/ldd
5232 -rwxr-xr-x. 1 root root 5354416 May 29 23:00 /usr/bin/ld.gold

I reinstalled binutils as you suggested (yum reinstall binutils) and I think this has done the trick! I rebooted and successfully installed "rgdal" from the Rstudio IDE. Thanks very much for your help! :slight_smile: