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

file_watcher feature fails to build for wasm32 because notify-debounder-full is only for native #10507

Closed
simbleau opened this issue Nov 11, 2023 · 1 comment · Fixed by #10589
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior O-Web Specific to web (WASM) builds

Comments

@simbleau
Copy link
Contributor

simbleau commented Nov 11, 2023

Bevy version

[dependencies]
bevy = { version = "0.12", default-features = false, features = [
  "bevy_asset",
  "file_watcher",
  # The rest don't matter
] }

What went wrong

we updated to using notify-debouncer-full-0.3.1 in bevy-asset 0.12:

$ cargo tree
│       │   ├── bevy_asset v0.12.0
│       │   │   ├── notify-debouncer-full v0.3.1

attempting to build for wasm32 will yield this lovely error:

error[E0432]: unresolved import `file_id::get_file_id`
   --> /Users/simbleau/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-debouncer-full-0.3.1/src/cache.rs:6:15
    |
6   | use file_id::{get_file_id, FileId};
    |               ^^^^^^^^^^^ no `get_file_id` in the root
    |
note: found an item that was configured out
   --> /Users/simbleau/.cargo/registry/src/index.crates.io-6f17d22bba15001f/file-id-0.2.1/src/lib.rs:111:8
    |
111 | pub fn get_file_id(path: impl AsRef<Path>) -> io::Result<FileId> {
    |        ^^^^^^^^^^^
    = note: the item is gated behind the `unix` feature
note: found an item that was configured out
   --> /Users/simbleau/.cargo/registry/src/index.crates.io-6f17d22bba15001f/file-id-0.2.1/src/lib.rs:121:8
    |
121 | pub fn get_file_id(path: impl AsRef<Path>) -> io::Result<FileId> {
    |        ^^^^^^^^^^^
    = note: the item is gated behind the `windows` feature

For more information about this error, try `rustc --explain E0432`.
error: could not compile `notify-debouncer-full` (lib) due to previous error

The key phrase here is: note: found an item that was configured out

this is because there is no wasm32 family function for get_file_id:
https://github.com/notify-rs/notify/blob/c4d047078549c2fec0bbfada29653097776b8b2d/file-id/src/lib.rs#L110

Solution

file_watcher should only bring in notify-debouncer-full on non wasm targets, and do nothing for wasm targets, just as it did before.

@simbleau simbleau added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 11, 2023
@simbleau
Copy link
Contributor Author

For those needing a fast solution:

  • Remove the file_watcher feature. It used to work on wasm-family systems (because it did nothing to watch for files on wasm) but those following the migration guide will find the issue above.

@simbleau simbleau changed the title bevy_asset fails to build on wasm32 - notify-debounder-full is only for native file_watcher feature fails to build for wasm32 because notify-debounder-full is only for native Nov 11, 2023
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds O-Web Specific to web (WASM) builds and removed S-Needs-Triage This issue needs to be labelled labels Nov 12, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 17, 2023
# Objective

- Currently, in 0.12 there is an issue that it is not possible to build
bevy for Wasm with feature "file_watcher" enabled. It still would not
compile, but now with proper explanation.
- Fixes #10507


## Solution

- Remove `notify-debouncer-full` dependency on WASM platform entirely.
- Compile with "file_watcher" feature now on platform `wasm32` gives
meaningful compile error.

---

## Changelog

### Fixed

- Compile with "file_watcher" feature now on platform `wasm32` gives
meaningful compile error.
cart pushed a commit that referenced this issue Nov 30, 2023
# Objective

- Currently, in 0.12 there is an issue that it is not possible to build
bevy for Wasm with feature "file_watcher" enabled. It still would not
compile, but now with proper explanation.
- Fixes #10507


## Solution

- Remove `notify-debouncer-full` dependency on WASM platform entirely.
- Compile with "file_watcher" feature now on platform `wasm32` gives
meaningful compile error.

---

## Changelog

### Fixed

- Compile with "file_watcher" feature now on platform `wasm32` gives
meaningful compile error.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
# Objective

- Currently, in 0.12 there is an issue that it is not possible to build
bevy for Wasm with feature "file_watcher" enabled. It still would not
compile, but now with proper explanation.
- Fixes bevyengine#10507


## Solution

- Remove `notify-debouncer-full` dependency on WASM platform entirely.
- Compile with "file_watcher" feature now on platform `wasm32` gives
meaningful compile error.

---

## Changelog

### Fixed

- Compile with "file_watcher" feature now on platform `wasm32` gives
meaningful compile error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior O-Web Specific to web (WASM) builds
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants