Repository: rust
Issue: Cannot compile under Rosetta 2 on Macos
Labels: I-crash,O-macos,O-x86_64,T-compiler,C-bug,O-AArch64

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I'm building rust from source on MacOS inside a Rosetta 2 emulator on an M1 Mac (I use macports).

Basically, building rust on an emulated x86_64 does not work.

```bash
arch -x86_64 /bin/zsh
sudo port install -s rust
```

I expected to see this happen: Rust to compile.

Instead, this happened:

```
:info:build error: process didn't exit successfully: `/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/bootstrap/debug/rustc -vV` (exit status: 254)
:info:build --- stdout
:info:build Did not run successfully: signal: 6 (SIGABRT)
:info:build DYLD_LIBRARY_PATH="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/stage1/lib" "/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/stage1/bin/rustc" "-vV" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "-Clinker=/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/compwrap/ld/usr/bin/clang" "-Zunstable-options" "--check-cfg=values(bootstrap)" "--remap-path-prefix" "/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work=/Users/user/macports-gimp3-x86_64/libexec/rust/src" "-Z" "force-unstable-if-unmarked"
:info:build -------------
:info:build --- stderr
:info:build <jemalloc>: Error allocating TSD
:info:build rustc exited with signal: 6 (SIGABRT)
:info:build command did not execute successfully: cd "/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src" && AR_x86_64_apple_darwin="/usr/bin/ar" CARGO_INCREMENTAL="0" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_TARGET_DIR="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/stage1-std" CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/compwrap/ld/usr/bin/clang" CC_x86_64_apple_darwin="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/compwrap/cc/usr/bin/clang" CFG_COMPILER_HOST_TRIPLE="x86_64-apple-darwin" CFG_DISABLE_UNSTABLE_FEATURES="1" CFG_RELEASE_CHANNEL="stable" CFLAGS_x86_64_apple_darwin="-ffunction-sections -fdata-sections -fPIC --target=x86_64-apple-darwin -stdlib=libc++" CXXFLAGS_x86_64_apple_darwin="-ffunction-sections -fdata-sections -fPIC --target=x86_64-apple-darwin -stdlib=libc++" CXX_x86_64_apple_darwin="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/compwrap/cxx/usr/bin/clang++" LIBC_CHECK_CFG="1" RANLIB_x86_64_apple_darwin="/usr/bin/ar s" REAL_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/native" RUSTC="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/tmp/extended-error-metadata" RUSTC_FORCE_UNSTABLE="1" RUSTC_HOST_LINKER="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/compwrap/ld/usr/bin/clang" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/stage1/lib" RUSTC_LINT_FLAGS="-Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros -Dwarnings" RUSTC_REAL="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/stage1/bin/rustc" RUSTC_SNAPSHOT="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.70.0-x86_64-apple-darwin/rustc/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.70.0-x86_64-apple-darwin/rustc/lib" RUSTC_STAGE="1" RUSTC_SYSROOT="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/x86_64-apple-darwin/stage1" RUSTC_VERBOSE="2" RUSTDOC="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="-Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options --check-cfg=values(bootstrap) --check-cfg=values(stdarch_intel_sde) --check-cfg=values(no_fp_fmt_parse) --check-cfg=values(no_global_oom_handling) --check-cfg=values(no_rc) --check-cfg=values(no_sync) --check-cfg=values(freebsd12) --check-cfg=values(freebsd13) --check-cfg=values(backtrace_in_libstd) --check-cfg=values(target_env,\"libnx\") --check-cfg=values(target_arch,\"asmjs\",\"spirv\",\"nvptx\",\"xtensa\") -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.71.1\t(eb26296b5\t2023-08-03)\t(built\tfrom\ta\tsource\ttarball) -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/1.71.1/\") -Zcrate-attr=warn(rust_2018_idioms)" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="-Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options --check-cfg=values(bootstrap) --check-cfg=values(stdarch_intel_sde) --check-cfg=values(no_fp_fmt_parse) --check-cfg=values(no_global_oom_handling) --check-cfg=values(no_rc) --check-cfg=values(no_sync) --check-cfg=values(freebsd12) --check-cfg=values(freebsd13) --check-cfg=values(backtrace_in_libstd) --check-cfg=values(target_env,\"libnx\") --check-cfg=values(target_arch,\"asmjs\",\"spirv\",\"nvptx\",\"xtensa\") -Zmacro-backtrace -Zosx-rpath-install-name -Clink-args=-Wl,-rpath,@loader_path/../lib -Csplit-debuginfo=unpacked -Cprefer-dynamic -Zinline-mir -Cembed-bitcode=yes -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/1.71.1/\")" RUST_COMPILER_RT_ROOT="/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/src/llvm-project/compiler-rt" RUST_TEST_THREADS="10" WINAPI_NO_BUNDLED_LIBRARIES="1" __CARGO_DEFAULT_LIB_METADATA="stablestd" "/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.70.0-x86_64-apple-darwin/cargo/bin/cargo" "build" "--target" "x86_64-apple-darwin" "--release" "-Zcheck-cfg=names,values,output" "-Zbinary-dep-depinfo" "-j" "10" "-v" "-v" "--features" " panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/Users/user/macports-gimp3-x86_64/var/macports/build/_Users_user_macports-gimp3-x86_64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.71.1-src/library/sysroot/Cargo.toml" "--message-format" "json-render-diagnostics"
```

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

version is 1.71.1 but since it's not compiled, I can't do the verbose version.

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->

Backtrace N/A.

### Other

- Under platform support, this crate indicates tests don't pass on x86_64. https://crates.io/crates/tikv-jemallocator
- Someone having similar problems: https://github.com/paritytech/polkadot/issues/6591