Closed
Description
Reposting from rust-lang/rust#95057 just in case anyone in the openssl community encountered something similar.
I am working on project that uses openssl and compiles to wasm (wasm32-unknown-emscripten toolchain). It builds on Linux just fine, but when I try building it on my MacOS Big Sur, I get the following error (removing some irrelevant information from the output):
error: failed to run custom build command for `openssl-sys v0.9.72`
Caused by:
process didn't exit successfully: `/Users/alex/projects/mufl-poc-cpp/src/external/nitroattest/aws-nitroattest/target/debug/build/openssl-sys-c48c44c33a472711/build-script-main` (exit status: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=WASM32_UNKNOWN_EMSCRIPTEN_OPENSSL_NO_VENDOR
WASM32_UNKNOWN_EMSCRIPTEN_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
CC_wasm32-unknown-emscripten = None
CC_wasm32_unknown_emscripten = None
TARGET_CC = None
CC = None
CFLAGS_wasm32-unknown-emscripten = None
CFLAGS_wasm32_unknown_emscripten = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = None
running "perl" "./Configure" "--prefix=/Users/alex/projects/mufl-poc-cpp/src/external/nitroattest/aws-nitroattest/target/wasm32-unknown-emscripten/debug/build/openssl-sys-85f599ecbb1dcfeb/out/openssl-build/install" "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" "-g" "-fno-omit-frame-pointer" "-D__STDC_NO_ATOMICS__"
Configuring OpenSSL version 1.1.1n (0x101010efL) for gcc
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
[SNIP]
--- stderr
ar: creating archive apps/libapps.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: apps/libapps.a the table of contents is empty (no object file members in the library define global symbols)
ar: creating archive libcrypto.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: libcrypto.a the table of contents is empty (no object file members in the library define global symbols)
ar: creating archive libssl.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: libssl.a the table of contents is empty (no object file members in the library define global symbols)
LLVM ERROR: malformed uleb128, extends past end
/bin/sh: line 1: 64526 Abort trap: 6 ranlib "/Users/alex/projects/mufl-poc-cpp/src/external/nitroattest/aws-nitroattest/target/wasm32-unknown-emscripten/debug/build/openssl-sys-85f599ecbb1dcfeb/out/openssl-build/install/lib/$fn.new"
make: *** [install_dev] Error 134
thread 'main' panicked at '
Error installing OpenSSL:
Command: "make" "install_dev"
Exit status: exit status: 2
Obviously, it is incorrectly using Apple's native libraries and tools where it should be using those provided by emscripten. My workaround was to link emscripten's llvm-ar as ar (same for ranlib) and put them temporarily on the front of my $PATH, which works. Yet, I still wanted to report, or see if I'm missing something obvious wrt building wasm on MacOS.
Metadata
Metadata
Assignees
Labels
No labels