Build R from source and install it as our own rpm: how to set R_HOME_DIR

Hello, we are a small company that do not do a lot of R. We'd like to install many versions of R side by side. I already found this nice description https://rviews.rstudio.com/2018/03/21/multiple-versions-of-r/ that is really great.
The only issue is that we have a special way of deploying software, we basically create own own rpm to be deployed on all our boxes.
The build seem to be ok but when the rpm is deployed it seems that "at least" we have an issue with R_HOME_DIR that is not set to the proper value (I was expected the path from --prefix in the install)

[2019-05-21 16:47:23 me@ldzls43d 3.6]$ head /opt/third/R/3.6/bin/R
#!/bin/sh
# Shell wrapper for R executable.

R_HOME_DIR=R_HOME_DIR="/apps/bamboo_agent_1/bamboo-agent-home/xml-data/build-dir/TPP-RPL0-BP7/R-3.6.0"
if test "${R_HOME_DIR}" = "/opt/third/R/3.6.0/lib64/R"; then
   case "linux-gnu" in
   linux*)
     run_arch=`uname -m`
     case "$run_arch" in
        x86_64|mips64|ppc64|powerpc64|sparc64|s390x)

Is there a to control what R_HOME_DIR is "replaced" by (indeed it seems to be autogenerated)

I'm not 100% following your question here. It should be possible to turn this into an RPM, I would expect, although I know little about the process. For reference, this is what a build from source looks like on my system:

$ cat /opt/R/3.6.0/bin/R | head
#!/bin/bash
# Shell wrapper for R executable.

R_HOME_DIR=/opt/R/3.6.0/lib/R
if test "${R_HOME_DIR}" = "/opt/R/3.6.0/lib/R"; then
   case "linux-gnu" in
   linux*)
     run_arch=`uname -m`
     case "$run_arch" in
        x86_64|mips64|ppc64|powerpc64|sparc64|s390x)

Ideally, you would build and unpack the built version of R into the same location. The build of R will use the --prefix path to determine what R_HOME_DIR is. Your packaging / reusing process should not change that.

Is the head command you show something you executed on the built version, or the unpack? What does your build process look like? It looks like something weird happened to that first line... :open_mouth:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.