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

wasm-bindgen-rayon atomics/bulk-memory feature errors in workspace sub-directory builds #7

Open
thor314 opened this issue Jun 20, 2024 · 2 comments

Comments

@thor314
Copy link

thor314 commented Jun 20, 2024

My workspace containing this project as a dependency fails to build, though the member subdir succeeds at building. Removal of that subdir allows the project to build as expected.

In my workspace I have:

.
├── wasm-client - where `wasm-bindgen-rayon` lives
└── other-stuff

I have wasm-client/.cargo/config.toml containing:

# tell Cargo to build targeting wasm32
[build]
target = "wasm32-unknown-unknown"

# compiler adjustments for wasm-bindgen-rayon
[target.wasm32-unknown-unknown]
rustflags = [
              # failed attempts to silence warnings for using unstable compiler options for atomics, issue persists (different issue, not related to this github issue)
              # "-Z", "unstable-options",
              # "-A", "unstable_features",
              "-C", "target-feature=+atomics,+bulk-memory,+mutable-globals",
            ]

[unstable]
build-std = ["panic_abort", "std"]

When I cargo check from root, I obtain error:

~/pl/tlsn-monorepo tk-debug-wasm-path !1 ?1 ❯ cargo check -q           1.81.0-nightly
error: Did you forget to enable `atomics` and `bulk-memory` features as outlined in wasm-bindgen-rayon README?

When I cargo check from wasm-client, I see only the warning:

warning: unstable feature specified for `-Ctarget-feature`: `atomics`
  |
  = note: this feature is not stably supported; its behavior can change in the future

I would like to be able to use this library as a dependency without limiting my use of cargo. I did not see any related issues in this repo. Do you have any suggestions?

@sd2k
Copy link

sd2k commented Sep 25, 2024

It's far from ideal but I've worked around this by putting wasm-bindgen-rayon and all parallel functionality behind a non-default feature flag, which at least lets me run cargo commands from my workspace root without errors. I don't know that helps or not in your case, I agree that a better solution would be good.

@RReverser
Copy link
Owner

If you are in a workspace, your .cargo folder with the config should be at the root, not in the subfolder, otherwise it will be ignored.

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

No branches or pull requests

3 participants