Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Emscripten system detection in configure script #158

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

georgestagg
Copy link
Contributor

This change adds detection for cross-compiling using Emscripten in the configure script, allowing the ps 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.

@gaborcsardi
Copy link
Member

Thanks! What is R_OSTYPE in this case? Is it unix because of the cross-compiling? And uname returns Linux?

@georgestagg
Copy link
Contributor Author

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__LINUXnamed 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.

@gaborcsardi gaborcsardi merged commit 1951eaf into r-lib:main Dec 11, 2023
12 checks passed
@gaborcsardi
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants