Веб-сборка Rust не может быть создана из-за ошибки openssl - PullRequest
0 голосов
/ 21 июня 2020

Я новичок в ржавчине, и я создаю проект веб-сборки, используя его, использую пакет openssl в проекте. Теперь проблема возникает, когда я хочу создать приложение, оно не дает следующего вывода:

[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
   Compiling openssl-sys v0.9.58
error: failed to run custom build command for `openssl-sys v0.9.58`

Caused by:
  process didn't exit successfully: `/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/release/build/openssl-sys-815e530f9615c049/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=WASM32_UNKNOWN_UNKNOWN_OPENSSL_NO_VENDOR
WASM32_UNKNOWN_UNKNOWN_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
CC_wasm32-unknown-unknown = None
CC_wasm32_unknown_unknown = None
TARGET_CC = None
CC = None
CFLAGS_wasm32-unknown-unknown = None
CFLAGS_wasm32_unknown_unknown = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running "perl" "./Configure" "--prefix=/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install" "no-dso" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-shared" "gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown"
Configuring OpenSSL version 1.1.1g (0x1010107fL) for gcc
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

The library could not be configured for supporting multi-threaded
applications as the compiler options required on this system are not known.
See file INSTALL for details if you need multi-threading.

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
running "make" "depend"
running "make" "build_libs"
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
make depend && make _build_libs
make[1]: Entering directory '/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/build/src'
make[1]: Leaving directory '/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/build/src'
make[1]: Entering directory '/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/build/src'
clang  -I. -Iinclude  -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR="\"/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install/ssl\"" -DENGINESDIR="\"/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG   -c -o apps/app_rand.o apps/app_rand.c
clang  -I. -Iinclude  -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR="\"/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install/ssl\"" -DENGINESDIR="\"/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG   -c -o apps/apps.o apps/apps.c
clang  -I. -Iinclude  -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR="\"/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install/ssl\"" -DENGINESDIR="\"/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG   -c -o apps/bf_prefix.o apps/bf_prefix.c
make[1]: Leaving directory '/home/hamisi/Projects/payment-gateway/checkout/web/payload-formatter-wasm/target/wasm32-unknown-unknown/release/build/openssl-sys-881fa1458604c2ea/out/openssl-build/build/src'

--- stderr
/bin/sh: 1: clang: not found
make[1]: *** [Makefile:672: apps/app_rand.o] Error 127
make[1]: *** Waiting for unfinished jobs....
/bin/sh: 1: clang: not found
make[1]: *** [Makefile:674: apps/apps.o] Error 127
/bin/sh: 1: clang: not found
make[1]: *** [Makefile:676: apps/bf_prefix.o] Error 127
make: *** [Makefile:175: build_libs] Error 2
thread 'main' panicked at '


Error building OpenSSL:
    Command: "make" "build_libs"
    Exit status: exit code: 2


    ', /home/hamisi/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.10.0+1.1.1g/src/lib.rs:386:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit code: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

Я пробовал все решения в inte rnet, установлен libssldev, pkg-config, I также несколько раз переустанавливал openssl в моей машине, но все равно никаких плодов. Я отлаживал это в течение нескольких часов, но безуспешно.

Ниже приведен мой Cargo.toml раздел зависимостей содержимого

[dependencies]
wasm-bindgen = "0.2.63"
openssl-sys = "0.9"
openssl = { version = "0.10", features = ["vendored"] }
base64 = "0.12.1"

и я использую ubuntu 20.04. Любая помощь будет принята с благодарностью, так как у меня заканчивается время с этим, заранее спасибо.

openssl version выходы OpenSSL 1.1.1g 21 Apr 2020

Также дайте мне знать, когда вам понадобится дополнительная информация.

1 Ответ

1 голос
/ 12 июля 2020

Согласно rustwasm / wasm-bindgen, openssl crate не поддерживает WebAssembly

На самом деле это ошибка, о которой сообщает скрипт сборки openssl-sys, потому что ящик openssl еще не поддерживает WebAssembly (я не уверен, что сам OpenSSL поддерживает ...).

...