Skip to content

Using wrong toolchain when compiling with wasm32-unknown-emscripten on MacOS Big Sur #95057

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
alex-coinfund opened this issue Mar 17, 2022 · 2 comments
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!

Comments

@alex-coinfund
Copy link

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.

@Enselic
Copy link
Member

Enselic commented Jul 13, 2024

Triage: Is this still a problem after sfackler/rust-openssl#1613 was fixed?

@workingjubilee workingjubilee added the O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! label Oct 11, 2024
@jieyouxu jieyouxu added C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. needs-triage-legacy labels Nov 12, 2024
@jieyouxu
Copy link
Member

Triage: not a rustc issue.

@jieyouxu jieyouxu closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!
Projects
None yet
Development

No branches or pull requests

5 participants