[R] How Can I Build a Standalone Binary

Knecht, Logan |knecht @end|ng |rom |redhutch@org
Thu Aug 6 23:32:30 CEST 2020


Hello all,

===== The short version =====

I am trying to build a standalone version for R so that I can bundle and package a self-hosted environment for a shiny app. There are reasons for this decision, but it will only distract from the discussion.

The inspiration for this comes from here:
https://www.youtube.com/watch?v=ARrbbviGvjc
and here
https://github.com/dirkschumacher/r-shiny-electron

I have tried these solutions, to no avail as I repeatedly encounter issues with the process. Some issues have been difficulties importing libraries after repeating their steps, others have been issues with missing dynamic libraries that aren't available when I build from source.

===== Questions =====

-   How is the R binary at this link created?
    -   Link: https://cloud.r-project.org/bin/macosx/R-4.0.2.pkg
-   How do I include `libgfortran.5.dylib`
    -   This distributable, when configured shows a file called `libgfortran.5.dylib`
    -   As of this writing, my solution fails because this is missing when I run the self-hosted R
-   Is there any guidance on how to build a self-hosted R executable for each operating system?
    -   OSX
    -   Linux
    -   Windows

===== The long version =====

----- The Goal -----

Create a self hosted version of R that runs independent of each system so that I can package and build shiny apps to be distributed to collaborators in order to evangelize our new statistical method.

----- The Impetus -----

It is too distracting and too much work to get our collaborators to configure their environments just to try our statiscal methods we have been creating.

We have a shiny app built around the statistical methods to simplify the interface for interaction. Now we want to package it for easy consumption.

It should be as simple as downloading an application and running it.

----- The Current Progress -----

I have a repo here that is an electron application

https://github.com/FredHutch/FAUST_Nextflow_Desktop/tree/research/create_r_4_0_2_build-dev

I can bundle these resources without issues

-   Java
-   Nextflow
-   Our Shiny App

----- Process -----
The only missing piece is `R`

I have a set of environment variables here:
https://github.com/FredHutch/FAUST_Nextflow_Desktop/blob/research/create_r_4_0_2_build-dev/electron_faust_nextflow_desktop/app/binaries/r/build_environment_variables.env

I `source` the env variables and then I run this script here:
`https://github.com/FredHutch/FAUST_Nextflow_Desktop/blob/research/create_r_4_0_2_build-dev/electron_faust_nextflow_desktop/app/binaries/r/download_r_osx.sh`

I then use the downloaded `R` to install dependencies with these scripts:

-   https://github.com/FredHutch/FAUST_Nextflow_Desktop/blob/research/create_r_4_0_2_build-dev/electron_faust_nextflow_desktop/app/binaries/r/install_r_dependencies.r
-   https://github.com/FredHutch/FAUST_Nextflow_Desktop/blob/research/create_r_4_0_2_build-dev/electron_faust_nextflow_desktop/app/binaries/r/install_r_cran_dependencies.r
-   https://github.com/FredHutch/FAUST_Nextflow_Desktop/blob/research/create_r_4_0_2_build-dev/electron_faust_nextflow_desktop/app/binaries/r/install_r_biocmanager_dependencies.r

And then voilà! It works. Well. It works on my local machine. I can run the development build, I can package the build, I can run the release after installing it. Everything works.

Except when I bring it over to a separate computer it doesn't work because it states that it can't find `libgfortran.5.dylib`. See the attached screen shot.

===== The Plea For Guidance =====

I would love any help to figure out how to achieve this. We are very close to somethng tangibly interesting and it's very deflating to be blocked because `R` does not have a distributable that can be bundled.

Any guidance or suggestions are greatly appreciated!

Warm Regards,

Logan Knecht

	[[alternative HTML version deleted]]



More information about the R-help mailing list