Skip to content

Support wasm32-unknown-unknown without wasm-bindgen #583

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

rikhuijzer
Copy link

@rikhuijzer rikhuijzer commented Mar 29, 2025

Thank you for making this software available. I think numerical packages in pure Rust are really important.

This PR allows for succesfully building armin with

$ cargo build -p argmin --no-default-features --target wasm32-unknown-unknown

As a bit of background, the wasm (synonym: WebAssembly) situation is a bit complication right now. As I understand it, most wasm targets assume that Javascript is available too. So that's why getrandom/js often works. However, more and more wasm targets are moving away from Javascript. Wasmtime, for example, is a wasm runtime that does not support Javascript. This is useful for example for plugin systems like is used by Typst or Zellij. Both allow developers to write plugins which then can be used by users. But to not compromise the whole system, the plugins are sandboxed by default. So these plugins typically are not allowed to access the filesystem, or other system interfaces; also not via JS bindgen.

But I think it would be very nice if we could argmin in these barebone environments. To do so, this PR suggests to fix the build.

@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.12%. Comparing base (b35808a) to head (dc43934).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #583      +/-   ##
==========================================
- Coverage   92.13%   92.12%   -0.01%     
==========================================
  Files         177      177              
  Lines       23672    23672              
==========================================
- Hits        21810    21808       -2     
- Misses       1862     1864       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rikhuijzer
Copy link
Author

rikhuijzer commented Apr 1, 2025

@stefan-k My apologies for the failing CI jobs in 68cf721 and dc43934.

I now tested this PR in my own fork (rikhuijzer#1) and CI should pass now. I also added a test that explicitly tests this wasm32-unknown-unknown without wasm-bindgen.

My compliments by the way for the CI testing setup. The tests are very thorough.

@rikhuijzer rikhuijzer changed the title Support wasm32-unknown-unknown compilation Support wasm32-unknown-unknown without wasm-bindgen Apr 1, 2025
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