r-wasm / rwasm

Build R packages for WebAssembly and create a CRAN-like repo for distribution.
https://r-wasm.github.io/rwasm/
Other
56 stars 4 forks source link

Problem with JS scrips on PATH #6

Closed jeroen closed 6 months ago

jeroen commented 11 months ago

Some R packages fail to build because we put /opt/webr/wasm/bin on the PATH at build time. However this dir contains javascript tools, that the host can not execute. Is it really required to have this on the PATH?

https://github.com/r-wasm/rwasm/blob/c15083fa2f228c08c08f49dc663e87cc5f69e70b/R/build.R#L61

For example packages cannot extract a tar.xz file because /usr/bin/xz is masked by /opt/webr/wasm/bin/xz.

georgestagg commented 11 months ago

The wasm/bin directory is added to the path because some of the files in there are useful shell scripts, e.g. gdal-config. However, I can see that most of the files in there should not be on the PATH.

I think a good solution would be to update webR's Makefiles for building Wasm system libraries so that they copy any useful host-compatible scripts into webr/host/bin, then remove webr/wasm/bin from the path here and add host/bin instead. That should avoid JS tools like xz getting in the way.

I'll open a related Issue in r-wasm/webr, then return here once that's been implemented.

shikokuchuo commented 9 months ago

The masking appears to be solved, but now there is a tar: This does not look like a tar archive error - my sources are in .tar.xz files.

e.g. at: https://github.com/r-universe/shikokuchuo/actions/runs/7596020168/job/20689283194

I'm bringing this up as I've just been made aware that, apparently, it is possible to compile the NNG library using emscripten. I'd like to investigate what is currently possible if I can get past this install step. Thanks.

shikokuchuo commented 6 months ago

@georgestagg I can confirm that the issue with 'xz' at least is resolved. After a bit of tweaking to the CMake files, NNG and MbedTLS are compiling! https://github.com/r-universe/shikokuchuo/actions/runs/8639056802/job/23684720195