Skip to content

Error when trying to compile into wasm #1723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xujizhong opened this issue Nov 7, 2022 · 4 comments
Closed

Error when trying to compile into wasm #1723

xujizhong opened this issue Nov 7, 2022 · 4 comments

Comments

@xujizhong
Copy link

error: failed to run custom build command for openssl-sys v0.9.77

Caused by:
process didn't exit successfully: /Users/admin/xjz/express-play/rust/target/release/build/openssl-sys-040214a0e4d3af8c/build-script-main (exit status: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rustc-cfg=openssl
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
cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
CC_wasm32-unknown-unknown = None
cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
CC_wasm32_unknown_unknown = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
CFLAGS_wasm32-unknown-unknown = None
cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
CFLAGS_wasm32_unknown_unknown = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running "perl" "./Configure" "--prefix=/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown"
Configuring OpenSSL version 1.1.1s (0x1010113fL) 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"
perl "-I." -Mconfigdata "util/dofile.pl"
"-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
perl "-I." -Mconfigdata "util/dofile.pl"
"-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
perl "-I." -Mconfigdata "util/dofile.pl"
"-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make depend && /Applications/Xcode.app/Contents/Developer/usr/bin/make _build_libs
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -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=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF apps/apps.d.tmp -MT apps/apps.o -c -o apps/apps.o apps/apps.c
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF apps/bf_prefix.d.tmp -MT apps/bf_prefix.o -c -o apps/bf_prefix.o apps/bf_prefix.c
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF apps/opt.d.tmp -MT apps/opt.o -c -o apps/opt.o apps/opt.c
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF apps/s_cb.d.tmp -MT apps/s_cb.o -c -o apps/s_cb.o apps/s_cb.c
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF apps/s_socket.d.tmp -MT apps/s_socket.o -c -o apps/s_socket.o apps/s_socket.c
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF crypto/aes/aes_cbc.d.tmp -MT crypto/aes/aes_cbc.o -c -o crypto/aes/aes_cbc.o crypto/aes/aes_cbc.c
clang -I. -Iinclude -O3 -O2 -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/Users/admin/xjz/express-play/rust/target/wasm32-unknown-unknown/release/build/openssl-sys-e441d27b551276d4/out/openssl-build/install/lib/engines-1.1"" -DNDEBUG -MMD -MF crypto/aes/aes_cfb.d.tmp -MT crypto/aes/aes_cfb.o -c -o crypto/aes/aes_cfb.o crypto/aes/aes_cfb.c

--- stderr
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>
^~~~~~~~~~~~
apps/bf_prefix.c:10:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
In file included from apps/opt.c:9:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>
^~~~~~~~~~~~
error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
apps/s_socket.c:11:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
1 error generated.
apps/s_cb.c:11:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
make[1]: *** [crypto/aes/aes_cfb.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [crypto/aes/aes_cbc.o] Error 1
apps/apps.c:18:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
1 error generated.
make[1]: *** [apps/app_rand.o] Error 1
make[1]: *** [apps/bf_prefix.o] Error 1
1 error generated.
make[1]: *** [apps/opt.o] Error 1
1 error generated.
make[1]: *** [apps/s_socket.o] Error 1
1 error generated.
make[1]: *** [apps/s_cb.o] Error 1
1 error generated.
make[1]: *** [apps/apps.o] Error 1
make: *** [build_libs] Error 2
thread 'main' panicked at '

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

@Azorlogh
Copy link

Azorlogh commented Nov 8, 2022

I am also getting an issue since today but a different one:

error: failed to run custom build command for `openssl-sys v0.9.77`
Caused by:
  process didn't exit successfully: `/omitted/target/dev-wasm/build/openssl-sys-f79082c4eccb6419/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rustc-cfg=openssl
  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: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."

  --- 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.77

  ', /home/phlimy/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/find_normal.rs:191:5
  stack backtrace:
     0:     0x5654de561730 - std::backtrace_rs::backtrace::libunwind::trace::h7391e70e9743ac3b
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1:     0x5654de561730 - std::backtrace_rs::backtrace::trace_unsynchronized::hb533880d0da65762
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x5654de561730 - std::sys_common::backtrace::_print_fmt::h705fe5c96394747d
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/sys_common/backtrace.rs:65:5
     3:     0x5654de561730 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc163ecc0e9e3b67b
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/sys_common/backtrace.rs:44:22
     4:     0x5654de580ede - core::fmt::write::h8a2cd58fbfedc72a
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/fmt/mod.rs:1209:17
     5:     0x5654de55e195 - std::io::Write::write_fmt::h0856ac540cc5a5a6
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/io/mod.rs:1682:15
     6:     0x5654de5614f5 - std::sys_common::backtrace::_print::h85dee81e7d66c5ec
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/sys_common/backtrace.rs:47:5
     7:     0x5654de5614f5 - std::sys_common::backtrace::print::he51a3a7405ebfeef
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/sys_common/backtrace.rs:34:9
     8:     0x5654de562eff - std::panicking::default_hook::{{closure}}::hdc5c50ac26371cf9
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:267:22
     9:     0x5654de562c3a - std::panicking::default_hook::h80e60a78e3d971de
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:286:9
    10:     0x5654de5635fc - std::panicking::rust_panic_with_hook::h1dda0be18358556d
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:688:13
    11:     0x5654de563397 - std::panicking::begin_panic_handler::{{closure}}::hf22e856169ad9ef9
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:579:13
    12:     0x5654de561bdc - std::sys_common::backtrace::__rust_end_short_backtrace::h0a8098570d653a12
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/sys_common/backtrace.rs:137:18
    13:     0x5654de5630b2 - rust_begin_unwind
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:575:5
    14:     0x5654de4984d3 - core::panicking::panic_fmt::h3889a73c07f2974e
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/panicking.rs:65:14
    15:     0x5654de4a4735 - core::panicking::panic_display::hc1a8c84d6d546ab9
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/panicking.rs:139:5
    16:     0x5654de4a3886 - build_script_main::find_normal::find_openssl_dir::h40702ac7d4345f4b
                                 at /home/phlimy/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/find_normal.rs:191:5
    17:     0x5654de4a22f2 - build_script_main::find_normal::get_openssl::{{closure}}::hbcc13986b513827d
                                 at /home/phlimy/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/find_normal.rs:15:68
    18:     0x5654de4a6599 - core::option::Option<T>::unwrap_or_else::hb946391b467323ea
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/option.rs:828:21
    19:     0x5654de4a1f18 - build_script_main::find_normal::get_openssl::ha27b775e89861ae9
                                 at /home/phlimy/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/find_normal.rs:15:31
    20:     0x5654de49a98a - build_script_main::find_openssl::he30f60a64e382562
                                 at /home/phlimy/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/main.rs:60:5
    21:     0x5654de49aaa0 - build_script_main::main::h285b649a784df73a
                                 at /home/phlimy/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/main.rs:80:35
    22:     0x5654de49f12b - core::ops::function::FnOnce::call_once::h2d55ac9ee1c8e004
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/ops/function.rs:510:5
    23:     0x5654de49f06e - std::sys_common::backtrace::__rust_begin_short_backtrace::hf5e8ac29c3745d97
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/sys_common/backtrace.rs:121:18
    24:     0x5654de4a6d51 - std::rt::lang_start::{{closure}}::h46ba63831675bc50
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/rt.rs:166:18
    25:     0x5654de55aa8b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h187b9fd81c60c306
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/ops/function.rs:606:13
    26:     0x5654de55aa8b - std::panicking::try::do_call::h4ceb5227a52d2621
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:483:40
    27:     0x5654de55aa8b - std::panicking::try::h1156e3af87e78a5c
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:447:19
    28:     0x5654de55aa8b - std::panic::catch_unwind::h6712fa992fd58f35
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panic.rs:137:14
    29:     0x5654de55aa8b - std::rt::lang_start_internal::{{closure}}::h3eb7fc84d52a5546
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/rt.rs:148:48
    30:     0x5654de55aa8b - std::panicking::try::do_call::h28ac6f3b79cc44a5
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:483:40
    31:     0x5654de55aa8b - std::panicking::try::h79b958a697c3b726
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:447:19
    32:     0x5654de55aa8b - std::panic::catch_unwind::hd25d6725f7f76c37
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panic.rs:137:14
    33:     0x5654de55aa8b - std::rt::lang_start_internal::h12f6097e44bf4bb9
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/rt.rs:148:20
    34:     0x5654de4a6d2a - std::rt::lang_start::h10489f55ec857e60
                                 at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/rt.rs:165:17
    35:     0x5654de49e9ae - main
    36:     0x7f392b70a290 - <unknown>
    37:     0x7f392b70a34a - __libc_start_main
    38:     0x5654de498865 - _start
                                 at /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115
    39:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

@sfackler
Copy link
Owner

sfackler commented Nov 8, 2022

I am not familiar with OpenSSL's ability to target wasm.

@Azorlogh
Copy link

Azorlogh commented Nov 8, 2022

Actually scrap my comment, I thought it was working before but it probably wasn't, I was just using a different dependency 🤦

@Skepfyr
Copy link
Collaborator

Skepfyr commented Jan 5, 2023

Compiling OpenSSL for wasm appears to be difficult but potentially possible, I'm closing this issue in favour of #1016 .

@Skepfyr Skepfyr closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants