http-rs / http-rs/surf

Crate won't compile to wasm

Open
#210 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Hello, seeing the `wasm-client` feature available, I expected surf to compile to `wasm32-unknown-unknown` as well. But it seems it pulls in `openssl` which does not compile to wasm. Am I missing something? Thanks
```
✗ cat Cargo.toml
[package]
name = "surf-test"
version = "0.1.0"
authors = ["Iulian Gabriel Radu "]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
surf = { version = "2.0.0-alpha.4", features = ["wasm-client"], default-features = false }

```

```
✗ cargo build --target wasm32-unknown-unknown
Compiling openssl-sys v0.9.58
Compiling gloo-timers v0.2.1
error: failed to run custom build command for `openssl-sys v0.9.58`

Caused by:
process didn't exit successfully: `/home/master/github/surf-test/target/debug/build/openssl-sys-609a3c9f29c5de9c/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=WASM32_UNKNOWN_UNKNOWN_OPENSSL_LIB_DIR
WASM32_UNKNOWN_UNKNOWN_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=WASM32_UNKNOWN_UNKNOWN_OPENSSL_INCLUDE_DIR
WASM32_UNKNOWN_UNKNOWN_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=WASM32_UNKNOWN_UNKNOWN_OPENSSL_DIR
WASM32_UNKNOWN_UNKNOWN_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_wasm32-unknown-unknown
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_wasm32_unknown_unknown
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_wasm32-unknown-unknown
cargo:rerun-if-env-changed=PKG_CONFIG_wasm32_unknown_unknown
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_wasm32-unknown-unknown
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_wasm32_unknown_unknown
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: "Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = wasm32-unknown-unknown
openssl-sys = 0.9.58

', /home/master/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.58/build/find_normal.rs:157:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.