When I worked on the MDN article "Compile from Rust to WebAssembly", there were some things that didn't work, so I'll write it as a reminder.
Work environment |
---|
Windows 10 Pro 20H2 |
Ubuntu 20.04 LTS (WSL2) |
Rust 1.48.0 |
The cause was that I was using Remote-WSL with VScode on the Windows side to open a working folder on Ubuntu. I don't think people who do this are so, but I will write it for the time being. The message was subtle, so it took me more time than I expected.
cc
not found error with cargo install wasm-pack.python
cargo install wasm-pack
When I run the command, wasm-pack downloads and builds a large number of dependent packages, but it seems that it can be done if the linker is not installed.
python
error: linker `cc` not found
Let's install gcc.
python
sudo apt install gcc
openssl-sys v0.9.60
error occurs.When I installed gcc and tried again, I got the following error this time:
python
error: failed to run custom build command for `openssl-sys v0.9.60`
There was a revelation to install pkg-config in a large number of debug messages.
It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.
Perform the installation.
python
sudo apt install pkg-config
Finally, the wasm-pack installation is complete.
Installed package `wasm-pack v0.9.1` (executable `wasm-pack`)
Recommended Posts