Skip to content

Add wasm32-unknown-emscripten support#43

Merged
lovasoa merged 9 commits intorust-or:masterfrom
sssxks:master
Feb 15, 2026
Merged

Add wasm32-unknown-emscripten support#43
lovasoa merged 9 commits intorust-or:masterfrom
sssxks:master

Conversation

@sssxks
Copy link
Contributor

@sssxks sssxks commented Feb 10, 2026

closes #42

  • sort out a build.rs config to compile to wasm32-unknown-emscripten successfully
  • added a CI

Copy link
Collaborator

@lovasoa lovasoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix ! I added a few comments below

Comment on lines 57 to 65
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ensure emsdk is properly cached ? Otherwise it'll slow down ci. Maybe use https://github.com/mymindstorm/setup-emsdk ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. i also pins emsdk version now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mymindstorm is abandoned. mymindstorm/setup-emsdk#48 i am using fork pyodide/setup-emsdk@v15

build.rs Outdated
Comment on lines 93 to 94
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't specific to emscripten is it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

91-92: issue opened in cc crate.

93-94: moved out from if statement

build.rs Outdated
Comment on lines 44 to 55
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to re-detect emscripten here ? Isn't cargo supposed to set the right sysroot automatically ?

Copy link
Contributor Author

@sssxks sssxks Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after some digging, this issue still opens cross builds where bindgen picks up host headers instead of target headers

a few related PRs in this issue adds BINDGEN_EXTRA_CLANG_ARGS, BINDGEN_EXTRA_CLANG_ARGS_<TARGET> and ParseCallbacks::read_env_var.

afaik, BINDGEN_EXTRA_CLANG_ARGS_<TARGET> seems for user-side overriding, so I guess current code makes more sense

@sssxks sssxks requested a review from lovasoa February 15, 2026 07:34
@sssxks
Copy link
Contributor Author

sssxks commented Feb 15, 2026

For emscripten targets, parse headers as HOST in bindgen and disable layout tests.\n\nThis avoids missing Highs_* function declarations in generated bindings, while keeping the existing CMake exception flags fix.
@lovasoa lovasoa merged commit c6efe36 into rust-or:master Feb 15, 2026
4 checks passed
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.

Add WebAssembly support

2 participants

Comments