2021-01-20 | Apps | Rendering dot with R on L1G3R
Install R from source. We need the DOT package, and will use the static V8 when we compile the package:
divine [ ~ ]$ export DOWNLOAD_STATIC_LIBV8=1 divine [ ~ ]$ R R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-pc-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('DOT') Warning in install.packages("DOT") : 'lib = "/usr/lib64/R/library"' is not writable Would you like to use a personal library instead? (yes/No/cancel) yes Would you like to create a personal library ‘~/R/x86_64-pc-linux-gnu-library/4.0’ to install packages into? (yes/No/cancel) yes --- Please select a CRAN mirror for use in this session --- Secure CRAN mirrors 1: 0-Cloud [https] 2: Australia (Canberra) [https] . . . 70: USA (IA) [https] 71: USA (KS) [https] 72: USA (MI) [https] 73: USA (OH) [https] 74: USA (OR) [https] 75: USA (TN) [https] 76: USA (TX 1) [https] 77: Uruguay [https] 78: (other mirrors) Selection: 70 also installing the dependencies ‘Rcpp’, ‘jsonlite’, ‘curl’, ‘V8’ trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/Rcpp_1.0.6.tar.gz' Content type 'application/x-gzip' length 2952876 bytes (2.8 MB) ================================================== downloaded 2.8 MB trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/jsonlite_1.7.2.tar.gz' Content type 'application/x-gzip' length 421716 bytes (411 KB) ================================================== downloaded 411 KB . . . trying URL 'https://ftp.osuosl.org/pub/cran/src/contrib/DOT_0.1.tar.gz' Content type 'application/x-gzip' length 732007 bytes (714 KB) ================================================== downloaded 714 KB * installing *source* package ‘V8’ ... ** package ‘V8’ successfully unpacked and MD5 sums checked ** using staged installation Found C++14 compiler: g++ > curl::curl_download("http://jeroen.github.io/V8/get-v8-linux.sh","get-v8-linux.sh") > > grep: support for the -P option is not compiled into this --disable-perl-regexp binary > curl::curl_download('http://jeroen.github.io/V8/v8-8.3.110.13-linux.tar.gz','libv8.tar.gz',quiet=FALSE) [100%] Downloaded 10522980 bytes... > > Using CXXCPP=g++ -std=gnu++14 -E Using PKG_CFLAGS=-I/tmp/RtmpqSNy77/R.INSTALL5c8532074e44/V8/v8/include Using PKG_LIBS=-L/tmp/RtmpqSNy77/R.INSTALL5c8532074e44/V8/v8/lib -lv8_monolith Running feature test for pointer compression... Pointer compression not needed ** libs rm -f V8.so RcppExports.o bindings.o g++ -std=gnu++14 -I"/usr/lib64/R/include" -DNDEBUG -I/tmp/RtmpqSNy77/R.INSTALL5c8532074e44/V8/v8/include -DV8_ENABLE_CHECKS -I'/home/divine/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o g++ -std=gnu++14 -I"/usr/lib64/R/include" -DNDEBUG -I/tmp/RtmpqSNy77/R.INSTALL5c8532074e44/V8/v8/include -DV8_ENABLE_CHECKS -I'/home/divine/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include' -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c bindings.cpp -o bindings.o g++ -std=gnu++14 -shared -L/usr/local/lib64 -o V8.so RcppExports.o bindings.o -L/tmp/RtmpqSNy77/R.INSTALL5c8532074e44/V8/v8/lib -lv8_monolith installing to /home/divine/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-V8/00new/V8/libs ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (V8) * installing *source* package ‘DOT’ ... ** package ‘DOT’ successfully unpacked and MD5 sums checked ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (DOT) The downloaded source packages are in ‘/tmp/Rtmpir2Cz6/downloaded_packages’
To render a dot file in R, enter R and run these commands:
> library(DOT) > dot("digraph { + 1->2->3->5 + 4->5 + }", file="out.svg") >
The graph looks like this: