Hi, I'm trying to cross-compile R to javascript so that it can run in a web-browser. Take as long as you need to stop laughing. So, as I was saying - I want to try and get a build of R running in the browser. [If you're not familiar with it already, you might enjoy looking at emscripten.org. It's a remarkably capable tool for translating LLVM bitcode to javascript. Check out some of the demos!] I'm trying to start out with the most minimal build of R possible. I can turn off various options in the configure script, but I'm wondering about the bundled R packages (base, stats etc). I'm guessing that the native code portions of these packages are dynamically loaded at runtime, which will probably need patching. To start off, I'd like to not build these packages if possible. So, is there a way to configure which packages in the library get built or is it just a case of editing the makefile? And is there a minimal set of them that would still allow R to run (not be useful - that can come later - just run)? Thanks in advance for any help anyone can provide :-) Jony -- Centre for Cold Matter, The Blackett Laboratory, Imperial College London, London SW7 2BW T: +44 (0)207 5947741 http://www.imperial.ac.uk/people/jony.hudson http://www.imperial.ac.uk/ccm/research/edm http://www.monkeycruncher.org http://j-star.org/ --
Jony, I'm currently writing up the paper for something with a similar result but very different implementation. The RBrowserPlugin package/browser plugin (joint with my advisor Duncan Temple Lang) embeds R within the web browser as an NPAPI plugin. This approach allows full bi-directional communication between R and the javascript engine (including direct function calling and references to native objects in both directions) using a user's existing local R installation (including packages). Devel source at https://github.com/gmbecker/RFirefox, release, (hopefully) officially cross-platform version to coincide with the paper going off for review. I had toyed with the idea of the emscripten approach, but I think putting R in the browser once is enough for me at the moment so I will happily keep an eye on your project instead of attacking that myself :). As for your actual question I can't really say, other than that I suspect you will not be able to dispense with base and methods, but that I would conjecture that stats is "optional". ~G On Thu, May 2, 2013 at 9:12 AM, Jony Hudson <jony.hudson@imperial.ac.uk>wrote:> Hi, > > I'm trying to cross-compile R to javascript so that it can run in a > web-browser. Take as long as you need to stop laughing. So, as I was saying > - I want to try and get a build of R running in the browser. [If you're not > familiar with it already, you might enjoy looking at emscripten.org. It's > a remarkably capable tool for translating LLVM bitcode to javascript. Check > out some of the demos!] > > I'm trying to start out with the most minimal build of R possible. I can > turn off various options in the configure script, but I'm wondering about > the bundled R packages (base, stats etc). I'm guessing that the native code > portions of these packages are dynamically loaded at runtime, which will > probably need patching. To start off, I'd like to not build these packages > if possible. > > So, is there a way to configure which packages in the library get built or > is it just a case of editing the makefile? And is there a minimal set of > them that would still allow R to run (not be useful - that can come later - > just run)? > > Thanks in advance for any help anyone can provide :-) > > > Jony > > -- > Centre for Cold Matter, The Blackett Laboratory, > Imperial College London, London SW7 2BW > T: +44 (0)207 5947741 > http://www.imperial.ac.uk/people/jony.hudson > http://www.imperial.ac.uk/ccm/research/edm > http://www.monkeycruncher.org > http://j-star.org/ > -- > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Gabriel Becker Graduate Student Statistics Department University of California, Davis [[alternative HTML version deleted]]
On Thu, May 2, 2013 at 5:12 PM, Jony Hudson <jony.hudson at imperial.ac.uk> wrote:> Hi, > > I'm trying to cross-compile R to javascript so that it can run in a web-browser. Take as long as you need to stop laughing. So, as I was saying - I want to try and get a build of R running in the browser. [If you're not familiar with it already, you might enjoy looking at emscripten.org. It's a remarkably capable tool for translating LLVM bitcode to javascript. Check out some of the demos!] > > I'm trying to start out with the most minimal build of R possible. I can turn off various options in the configure script, but I'm wondering about the bundled R packages (base, stats etc). I'm guessing that the native code portions of these packages are dynamically loaded at runtime, which will probably need patching. To start off, I'd like to not build these packages if possible. > > So, is there a way to configure which packages in the library get built or is it just a case of editing the makefile? And is there a minimal set of them that would still allow R to run (not be useful - that can come later - just run)?You can run just "base:" for(i in 1:(length(search()) - 2)){detach(2)} search() Not sure if you need "compiler" around for the build process, but we survived without it once, so I'd assume you can get by without it if you're willing to tweak. Godspeed, MW
Hi, I'm making some progress with this, but have hit a sticking point and am looking for a hint. Most of the compilation seems to be going ok, after some liberal use of f2c, but I'm getting compile errors in src/main/connections.c : connections.c:926:43: error: use of undeclared identifier 'SSIZE_MAX' if ((double) size * (double) nitems > SSIZE_MAX) ^ connections.c:937:43: error: use of undeclared identifier 'SSIZE_MAX' if ((double) size * (double) nitems > SSIZE_MAX) ^ connections.c:3354:21: warning: implicit conversion from 'long long' to 'R_xlen_t' (aka 'int') changes value from 4503599627370496 to 0 [-Wconstant-conversion] nnn = (n < 0) ? R_XLEN_T_MAX : n; ~ ^~~~~~~~~~~~ ../../src/include/Rinternals.h:65:23: note: expanded from macro 'R_XLEN_T_MAX' # define R_XLEN_T_MAX 4503599627370496 ^~~~~~~~~~~~~~~~ connections.c:3662:11: error: duplicate case value '4' case sizeof(long): ^ connections.c:3660:11: note: previous case defined here case sizeof(int): ^ connections.c:3680:11: error: duplicate case value '4' case sizeof(long): ^ connections.c:3678:11: note: previous case defined here case sizeof(int): ^ connections.c:3912:11: error: duplicate case value '4' case sizeof(long): ^ connections.c:3910:11: note: previous case defined here case sizeof(int): ^ connections.c:3956:11: error: duplicate case value '4' case sizeof(long): ^ connections.c:3952:11: note: previous case defined here case sizeof(int): Recall that I'm compiling with emscripten, which uses clang to generate LLVM bitcode, which is then converted to javascript. I'm currently using the existing autotools build scripts, which emscripten tries to twist in to doing something sensible. It's quite possible that it's ending up mis-"./configure"d though. I appreciate this is fairly off-topic, but if anyone has any pointers where to start looking, they would be greatly appreciated :-) Thanks, Jony -- Centre for Cold Matter, The Blackett Laboratory, Imperial College London, London SW7 2BW T: +44 (0)207 5947741 http://www.imperial.ac.uk/people/jony.hudson http://www.imperial.ac.uk/ccm/research/edm http://www.monkeycruncher.org http://j-star.org/ -- On 2 May 2013, at 17:12, Jony Hudson <jony.hudson at imperial.ac.uk> wrote:> Hi, > > I'm trying to cross-compile R to javascript so that it can run in a web-browser. Take as long as you need to stop laughing. So, as I was saying - I want to try and get a build of R running in the browser. [If you're not familiar with it already, you might enjoy looking at emscripten.org. It's a remarkably capable tool for translating LLVM bitcode to javascript. Check out some of the demos!] > > I'm trying to start out with the most minimal build of R possible. I can turn off various options in the configure script, but I'm wondering about the bundled R packages (base, stats etc). I'm guessing that the native code portions of these packages are dynamically loaded at runtime, which will probably need patching. To start off, I'd like to not build these packages if possible. > > So, is there a way to configure which packages in the library get built or is it just a case of editing the makefile? And is there a minimal set of them that would still allow R to run (not be useful - that can come later - just run)? > > Thanks in advance for any help anyone can provide :-) > > > Jony > > -- > Centre for Cold Matter, The Blackett Laboratory, > Imperial College London, London SW7 2BW > T: +44 (0)207 5947741 > http://www.imperial.ac.uk/people/jony.hudson > http://www.imperial.ac.uk/ccm/research/edm > http://www.monkeycruncher.org > http://j-star.org/ > -- > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel