r-wasm / webr

The statistical language R compiled to WebAssembly via Emscripten, for use in web browsers and Node.
https://docs.r-wasm.org/webr/latest/
Other
848 stars 67 forks source link

Redirect `$(WASM)/lib/R/bin` JS binaries to use native R #367

Closed georgestagg closed 7 months ago

georgestagg commented 7 months ago

The binaries built by Emscripten in $(WASM)/lib/R/bin are JavaScript output, unable to be run directly by the host machine. Such binaries can be run using Node, but require some further setup (e.g. relocation of the required R.wasm file).

Since these scripts do not work when executed directly, Makevars targets relying on running R code using $(R_HOME)/bin/R fail. The symbols.rds target in lib/share/make/shlib.mk is an example of this issue.

With this commit, these specific scripts are redirected to use the version of R compiled for the host machine, working around the problem.

This should hopefully fix https://github.com/r-wasm/rwasm/issues/13.