Building scalpel with the command wasm-pack build --target web throws error.
Command Output
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
Compiling scalpel v0.4.0 (/home/harshit/code/scalpel)
error: feature "wasm" is required for "wasm32" targets.
--> src/lib.rs:45:1
|
45 | compile_error!("feature \"wasm\" is required for \"wasm32\" targets.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module wasm_bindgen
--> src/lib.rs:87:5
|
87 | use wasm_bindgen::prelude::*;
| ^^^^^^^^^^^^ use of undeclared crate or module wasm_bindgen
use crate::{Layer, Packet, ENCAP_TYPE_LINUX_SLL2};
^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
::: src/layers/tcp.rs:11:5
11
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/udp.rs:10:5
10
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/dns.rs:11:5
11
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/icmp.rs:10:5
10
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/icmpv6.rs:10:5
10
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/arp.rs:10:5
10
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/sctp.rs:12:5
12
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/m3ua.rs:10:5
10
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/mpls.rs:10:5
10
use crate::Layer;
^^^^^^^^^^^^
::: src/layers/vxlan.rs:7:5
7
use crate::Layer;
^^^^^^^^^^^^
::: src/packet.rs:13:5
|
13 | use crate::Layer;
| ^^^^^^^^^^^^
error: cannot find attribute wasm_bindgen in this scope
--> src/lib.rs:90:3
|
90 | #[wasm_bindgen]
| ^^^^^^^^^^^^
Some errors have detailed explanations: E0432, E0433.
For more information about an error, try rustc --explain E0432.
error: could not compile scalpel (lib) due to 4 previous errors
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute cargo build: exited with exit status: 101
full command: cd "/home/harshit/code/scalpel" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
System Info
OS: Ubuntu 20.04
CPU Architecture: x86_64
Rust version: 1.75.0
Building
scalpel
with the commandwasm-pack build --target web
throws error.Command Output
[INFO]: Checking for the Wasm target... [INFO]: Compiling to Wasm... Compiling scalpel v0.4.0 (/home/harshit/code/scalpel) error: feature "wasm" is required for "wasm32" targets. --> src/lib.rs:45:1 | 45 | compile_error!("feature \"wasm\" is required for \"wasm32\" targets."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module
wasm_bindgen
--> src/lib.rs:87:5 | 87 | use wasm_bindgen::prelude::*; | ^^^^^^^^^^^^ use of undeclared crate or modulewasm_bindgen
crate::Layer
,crate::Packet
,crate::ENCAP_TYPE_ETH
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Packet
,crate::ENCAP_TYPE_LINUX_SLL
,crate::Layer
,crate::Packet
,crate::ENCAP_TYPE_LINUX_SLL2
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
,crate::Layer
--> src/layers/ethernet/mod.rs:13:13::: src/packet.rs:13:5 | 13 | use crate::Layer; | ^^^^^^^^^^^^
error: cannot find attribute
wasm_bindgen
in this scope --> src/lib.rs:90:3 | 90 | #[wasm_bindgen] | ^^^^^^^^^^^^Some errors have detailed explanations: E0432, E0433. For more information about an error, try
rustc --explain E0432
. error: could not compilescalpel
(lib) due to 4 previous errors Error: Compiling your crate to WebAssembly failed Caused by: Compiling your crate to WebAssembly failed Caused by: failed to executecargo build
: exited with exit status: 101 full command: cd "/home/harshit/code/scalpel" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"System Info
OS: Ubuntu 20.04 CPU Architecture: x86_64 Rust version: 1.75.0