Skip to content

Instantly share code, notes, and snippets.

@jcheng5 jcheng5/README.md
Last active Aug 7, 2019

Embed
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: https://github.com/jeroen/solarisvm

At the time of this writing the link that points to is this one: https://drive.google.com/open?id=0B9GbYGrVAoVbT25SRFpNeC1mWTQ

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 172.16.107.203.

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 opencsw.org; 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
wget https://stat.ethz.ch/R/daily/R-devel.tar.gz
gzip -dc R-devel.tar.gz | tar -xvf -
cd R-devel

Configure and compile R

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

mv config.site config.site.orig
cat <<-EOF > config.site
	# From http://developer.r-project.org/CRAN/QA/BDR/Solaris/x86/gcc-devel/config.site
	CC="/opt/csw/bin/gcc"
	CFLAGS=-O2
	CPPFLAGS="-I/opt/csw/include -I/usr/local/include"
	FC="/opt/csw//bin/gfortran"
	FFLAGS=-O2
	CXX="/opt/csw/bin/g++"
	CXXFLAGS=-O2
	LDFLAGS="-L/usr/local/lib -L/opt/csw/lib"
	R_LD_LIBRARY_PATH="/usr/local/lib:/opt/csw/lib:/ripley/developerstudio12.6/lib:/usr/openwin/lib"
	EOF
# Loosely based on http://developer.r-project.org/CRAN/QA/BDR/Solaris/x86/gcc-devel/I.USED
# 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
gmake
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.

@jcheng5

This comment has been minimized.

Copy link
Owner Author

commented Jul 30, 2019

Note that with the above, I was not able to get https://cran.r-project.org/src/contrib/Archive/sass/sass_0.1.1.tar.gz 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 config.site 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.