Closed georgestagg closed 9 months ago
Thanks! What is R_OSTYPE
in this case? Is it unix
because of the cross-compiling? And uname
returns Linux
?
Yes, that's right. Due to the cross-compiling R_OSTYPE
will be unix
, but uname
will depend on the host, in practice Linux
or Darwin
depending on what OS the local webR install has been built on.
So, we override uname
based on the presence of $EMSCRIPTEN
and $CROSS_COMPILE
. Those env vars are set by the Emscripten emconfigure
wrapper, so they should be there whenever we're cross-compiling to Wasm using Emscripten.
In principle, we could extend this later to define an analogue of PS__LINUX
named PS__EMSCRIPTEN
and implement some of the functionality of ps
gated behind #ifdef
, but I don't think we really need that for any Wasm packages yet.
Thanks!
This change adds detection for cross-compiling using Emscripten in the
configure
script, allowing theps
package to be built for Emscripten/webR.The package itself does not make much sense under Wasm: there is just one process, no forking, and no POSIX signals. However,
ps
handles unsupported platforms reasonably by throwing a "Not implemented for this platform" error, and it is useful to have the package available for other packages that list it as a dependency.