orph3usLyre / muddy-waters

A static string obfuscation library for rust projects
Apache License 2.0
73 stars 3 forks source link

bug: could not find `wasi` in `os` #26

Open TheOrdinaryWow opened 1 month ago

TheOrdinaryWow commented 1 month ago

Hi. A bug occurred during build for wasm using wasm-pack.

Platform: Apple Silicon Rustc Version: 1.83.0-nightly (363ae4188 2024-09-24) Package Version: v0.2.2

Full error log:

[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling ****** v0.1.0 (******)
error[E0433]: failed to resolve: could not find `wasi` in `os`
  --> src/******:7:1
   |
7  | muddy_init!();
   | ^^^^^^^^^^^^^ could not find `wasi` in `os`
   |
note: found an item that was configured out
  --> ******/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/os/mod.rs:45:9
   |
45 | pub mod wasi {}
   |         ^^^^
note: the item is gated here
  --> ******/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/os/mod.rs:37:1
   |
37 | / #[cfg(all(
38 | |     doc,
39 | |     any(
40 | |         all(target_arch = "wasm32", not(target_os = "wasi")),
41 | |         all(target_vendor = "fortanix", target_env = "sgx")
42 | |     )
43 | | ))]
   | |___^
note: found an item that was configured out
  --> ******/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/os/mod.rs:87:9
   |
87 | pub mod wasi;
   |         ^^^^
note: the item is gated here
  --> ******/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/os/mod.rs:86:1
   |
86 | #[cfg(any(target_os = "wasi", doc))]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the macro `muddy_init` (in Nightly builds, run with -Z macro-backtrace for more info)

Guess it's related to #19 and #2.

orph3usLyre commented 1 month ago

Hello! Thanks for this. I've haven't tested this crate in a wasm environment yet, so I'm not surprised by these errors. I'll have to figure this out first, and I'll probably make a new release to support wasm, if possible.