Skip to content

Instantly share code, notes, and snippets.

@jcheng5 jcheng5/
Last active Aug 7, 2019

What would you like to do?
Installing R-devel on Solaris 10 VM

As far as CRAN is concerned, there are two flavors of R on Solaris: one that is built using the Solaris Studio compiler, and one that is built using the GNU/gcc toolchain. The latter is far more up-to-date, but if your package requires it, then your DESCRIPTION file must declare that with the line SystemRequirements: GNU make.

These instructions are for configuring, building, and installing R-devel using the GNU/gcc toolchain (only).

You'll need VMWare Fusion on Mac, or VMWare Workstation (?) on Windows/Linux.

Get Solaris VM

Download the Solaris VM provided by Jeroen Ooms:

At the time of this writing the link that points to is this one:

The username/password is root/solaris.

Create user

Creating a sudo user that can ssh in, will make things easier. By ssh-ing in from your desktop, you'll be able to cut/paste between your desktop and your Solaris prompt, which you can't do through the VMWare screen.

groupadd wheel
mkdir /users
useradd -s /bin/bash -G wheel -d /users/gnuuser -m gnuuser
passwd gnuuser

Before we can ssh in, we need to know the IP address of the VM. Run ifconfig e1000g0 and look at the value of inet; for me it's

Connect using ssh

From your desktop:

ssh gnuuser@<inet address goes here>

Give yourself sudo

su root -c "/opt/csw/bin/pkgutil -y -i sudo; echo gnuuser 'ALL=(ALL) NOPASSWD: ALL' > /etc/opt/csw/sudoers.d/gnuuser"
echo -e 'export PATH=/opt/csw/bin:$PATH\nexport PS1="\\h:\\W \\u\\$ "' >> ~/.bash_profile && . ~/.bash_profile

Install system dependencies

I don't really know the history here, but it seems like Solaris doesn't have a native package manager like yum/rpm on Red Hat or apt/dpkg on Debian. Jeroen's Solaris VM is configured with pkgutil, which uses packages from; all programs installed this way go into /opt/csw, not into /usr or whatever (hence we had to add /opt/csw/bin to the path in the previous section).

Anyway, we'll install all of the system dependencies we need via pkgutil, and make sure we configure with /opt/csw/lib on the library path.

sudo pkgutil -U
# This can take a VERY long time to download, especially gcc5gfortran.
sudo pkgutil -y -i wget gcc5gfortran libiconv_dev libz_dev liblzma_dev libpcre_dev libcurl_dev gmake libreadline_dev libssh2_dev libcares_dev libssl_dev librtmp_dev openldap_dev libbrotli_dev libkrb5_dev libcairo_dev gfile

Download R sources

mkdir -p ~/R
cd ~/R
gzip -dc R-devel.tar.gz | tar -xvf -
cd R-devel

Configure and compile R

First, we'll modify using mostly values from BDR, plus a couple of changes I found necessary to get the build to succeed.

cat <<-EOF >
	# From
	CPPFLAGS="-I/opt/csw/include -I/usr/local/include"
	LDFLAGS="-L/usr/local/lib -L/opt/csw/lib"
# Loosely based on
# PKG_CONFIG_PATH needs to be set or else cairo won't be found
# /usr/ccs/bin needs to be on the PATH or else ar won't be found
PATH=$PATH:/usr/ccs/bin PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig LD_LIBRARY_PATH=/opt/csw/lib ./configure -C --with-internal-tzcode --prefix=/opt/R-devel --enable-R-shlib
sudo gmake install

Use R

You can now run R-devel at /opt/R-devel/bin/R! (Be sure to use that path, not just whatever R is on your path, if you want R-devel.)

Installing Cairo

To use Shiny successfully, you'll need to install the Cairo package. To do so, be sure to set PKG_CONFIG_PATH when launching R:

PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig LD_LIBRARY_PATH=/opt/csw/lib /opt/R-devel/bin/R

In fact, it may not be a bad idea to add export PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig and export LD_LIBRARY_PATH=/opt/csw/lib to ~/.bash_profile. And perhaps export PATH=$PATH:/usr/ccs/bin as well.


This comment has been minimized.

Copy link
Owner Author

jcheng5 commented Jul 30, 2019

Note that with the above, I was not able to get to pass R CMD check; it failed to install due to the wrong make being used. However, prepending the R CMD check command with MAKE=gmake fixed the issue. Adding MAKE=gmake to before configuring fixes the issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.