Cannot compile cryptoki-sys to wasm target
Related to: Cannot compile dependency: could not find Library in libloading #1641
When I build, watch & serve a Rust WASM app with cryptoki, its dependency cryptoki-sys raise a compilation error.
The error is:
# cargo check --target wasm32-unknown-unknown
Checking ...
Checking cryptoki-sys v0.1.7 (registry `custom-regsitry`)
error[E0433]: failed to resolve: could not find `Library` in `libloading`
--> /root/.cargo/registry/src/custom-regsitry-url/cryptoki-sys-0.1.7/src/bindings/generic.rs:2164:37
|
2164 | let library = ::libloading::Library::new(path)?;
| ^^^^^^^ could not find `Library` in `libloading`
error[E0412]: cannot find type `Library` in crate `libloading`
--> /root/.cargo/registry/src/custom-regsitry-url/cryptoki-sys-0.1.7/src/bindings/generic.rs:1634:30
|
1634 | __library: ::libloading::Library,
| ^^^^^^^ not found in `libloading`
error[E0412]: cannot find type `Library` in crate `libloading`
--> /root/.cargo/registry/src/custom-regsitry-url/cryptoki-sys-0.1.7/src/bindings/generic.rs:2169:31
|
2169 | L: Into<::libloading::Library>,
| ^^^^^^^ not found in `libloading`
Some errors have detailed explanations: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `cryptoki-sys` (lib) due to 3 previous errors
Steps To Reproduce
- Make sure the
wasm32-unknown-unknown target for rust is installed
rustup target add wasm32-unknown-unknown
- (if you are using a custom Rust toolchain, add the wasm32 component into your
rust/toolchains/$custom-toolchain/components/ folder
- Install the dioxus command line allowing you to compile your rust app to wasm target
cargo install dioxus-cli
dx --help
- Create a rust application using the default dioxus template:
dx create, and select the following options:
- If you are working in an offline workspace:
download/unzip the dioxus-template
- run instead:
dx create --template dioxus-template-main
- If
$USER not found -> export USER=any, the value do not matter
# dx create --template dioxus-template-main
[WARN] You appear to be creating a Dioxus project from scratch; we will use the default config
[WARN] Favorite `dioxus-template-main` not found in config, using it as a local path: dioxus-template-main
...
✔ What platform are you targeting? · web
✔ Should the application use the dioxus router? · true
✔ How do you want to create CSS? · Vanilla
...
Expected behavior
Being able to compile after running dx serve:
Project Reloaded: Changed 1 files. [xx:xx:xx]
> Local : http://localhost:8080/
> Network : http://<IP>:8080/
> HTTPS : Disabled
> Profile : Debug
> Hot Reload : Normal
> Index Template : Default
> URL Rewrite [index_on_404] : False
> Build Time Use : 1190 millis
[INFO] A perfect compilation!
Environment:
I'm working on a Docker Container, offline, with a custom Rust toolchain and a custom registry. I've been working with them for 3 months and have never had a problem so far, so I want to remove these two from the possible error case.
With my toolchain and registry: I have two full Rust apps working. One with an Axum server and Dioxus client, communicating with REST and WebSockets. Another with cryptoki (RSA PKCS#11), without any issue so far.
- Dioxus version:
v0.4.0
- Dioxus cli version:
v0.4.1
- Cryptoki version:
v0.6.1
- Rust version:
1.70.0, stable
- OS info:
Docker container: Debian GNU/Linux 11 (bullseye)
Questionnaire
Cannot compile
cryptoki-systo wasm targetRelated to: Cannot compile dependency: could not find
Libraryinlibloading#1641When I build, watch & serve a Rust WASM app with
cryptoki, its dependencycryptoki-sysraise a compilation error.The error is:
# cargo check --target wasm32-unknown-unknown Checking ... Checking cryptoki-sys v0.1.7 (registry `custom-regsitry`) error[E0433]: failed to resolve: could not find `Library` in `libloading` --> /root/.cargo/registry/src/custom-regsitry-url/cryptoki-sys-0.1.7/src/bindings/generic.rs:2164:37 | 2164 | let library = ::libloading::Library::new(path)?; | ^^^^^^^ could not find `Library` in `libloading` error[E0412]: cannot find type `Library` in crate `libloading` --> /root/.cargo/registry/src/custom-regsitry-url/cryptoki-sys-0.1.7/src/bindings/generic.rs:1634:30 | 1634 | __library: ::libloading::Library, | ^^^^^^^ not found in `libloading` error[E0412]: cannot find type `Library` in crate `libloading` --> /root/.cargo/registry/src/custom-regsitry-url/cryptoki-sys-0.1.7/src/bindings/generic.rs:2169:31 | 2169 | L: Into<::libloading::Library>, | ^^^^^^^ not found in `libloading` Some errors have detailed explanations: E0412, E0433. For more information about an error, try `rustc --explain E0412`. error: could not compile `cryptoki-sys` (lib) due to 3 previous errorsSteps To Reproduce
wasm32-unknown-unknowntarget for rust is installedrustup target add wasm32-unknown-unknownrust/toolchains/$custom-toolchain/components/foldercargo install dioxus-clidx --helpdx create, and select the following options:download/unzipthe dioxus-templatedx create --template dioxus-template-main$USERnot found ->export USER=any, the value do not matterExpected behavior
Being able to compile after running
dx serve:Environment:
I'm working on a Docker Container, offline, with a custom Rust toolchain and a custom registry. I've been working with them for 3 months and have never had a problem so far, so I want to remove these two from the possible error case.
With my toolchain and registry: I have two full Rust apps working. One with an Axum server and Dioxus client, communicating with REST and WebSockets. Another with cryptoki (RSA PKCS#11), without any issue so far.
v0.4.0v0.4.1v0.6.11.70.0,stableDocker container:Debian GNU/Linux 11 (bullseye)Questionnaire