r-wasm / rwasm

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

Override LIBS variable #10

Closed jeroen closed 9 months ago

jeroen commented 9 months ago

Prevents packages from accessing the host LIBS.

This fixes the unrtf package.

georgestagg commented 9 months ago

Great spot, thanks!

A couple of things:

1) Setting this variable blank is better than using the host LIBS, but can we do better? I took a peak the Makeconf installed to the webR virtual filesystem and based on that perhaps something like this would be more accurate?

override LIBS = -L$(WASM)/lib -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm

OTOH that means keeping the list of libraries in sync, and a blank list might be OK to use here in any case... Do you happen to know if LIBS is used by any other packages?

2) This will allow the unrtf package to build, but it unfortunately still won't work. It relies on starting a process using sys::exec_wait, and this cannot be done under Emscripten as there is no support for fork().

jeroen commented 9 months ago

Maybe your suggestion is better. I am not sure what the official use of LIBS is actually, it seems a common use is add flags needed to build a an executable: https://github.com/search?q=org%3Acran%20path%3Asrc%2FMakevars%20%24(LIBS)&type=code

And yes sadly it still does not work, but at least it would be available as a dependency

georgestagg commented 9 months ago

I am not sure what the official use of LIBS is actually, it seems a common use is add flags needed to build a an executable

Okay. Since it's not used so much on CRAN (thanks for the search link!), and building a separate executable is not really useful under Emscripten right now in any case, let's leave it blank. It is easy to add these flags later if we really need them.

And yes sadly it still does not work, but at least it would be available as a dependency

True. Hopefully one day we will work something out between R and Emscripten for starting new processes under webR using additional JavaScript Web Workers.