Skip to content

Failed to build wasm32-unknown-unknown target with use-lld=true #139372

Closed
@12101111

Description

@12101111

Summary

Find this error when try to compile 1.86.0, also reproduce this on HEAD

Command used

./x build

Expected behaviour

It should build

Actual behaviour

error: linker flavor gnu-lld-cc is incompatible with the current target

Bootstrap configuration (bootstrap.toml)

[llvm]
download-ci-llvm = false
link-shared = true
use-libcxx = true
[build]
build = "x86_64-unknown-linux-musl"
target = ["x86_64-unknown-linux-musl","wasm32-unknown-unknown"]
verbose = 1
[install]
[rust]
default-linker = "clang"
use-lld = true
[target.x86_64-unknown-linux-musl]
ar = "llvm-ar"
cc = "clang"
cxx = "clang++"
linker = "clang"
ranlib = "llvm-ranlib"
llvm-libunwind = "system"
llvm-config = "/usr/lib/llvm/20/bin/llvm-config"
crt-static = false
musl-root = "/usr"
[target.wasm32-unknown-unknown]
linker = "lld"
profiler = false
sanitizers = false
[dist]

Operating system

Gentoo Linux

HEAD

a4166da

and 1.86.0 release tarball: 05f9846

Additional context

Build Log

Building stage1 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-unknown-linux-musl -> wasm32-unknown-unknown)
running: cd "/home/han/Project/rust" && env -u MAKEFLAGS -u MFLAGS AR_wasm32_unknown_unknown="/usr/lib/llvm/20/bin/llvm-ar" CARGO_INCREMENTAL="0" CARGO_LOG="cargo::core::compiler::fingerprint=info" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_PROFILE_RELEASE_STRIP="false" CARGO_TARGET_DIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1-std" CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER="lld" CC_wasm32_unknown_unknown="clang" CFG_COMPILER_BUILD_TRIPLE="x86_64-unknown-linux-musl" CFG_COMPILER_HOST_TRIPLE="wasm32-unknown-unknown" CFG_RELEASE_CHANNEL="dev" CFLAGS_wasm32_unknown_unknown="" CXXFLAGS_wasm32_unknown_unknown="" CXX_wasm32_unknown_unknown="clang++" LIBC_CHECK_CFG="1" RANLIB_wasm32_unknown_unknown="/usr/lib/llvm/20/bin/llvm-ar s" REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/home/han/Project/rust/build/wasm32-unknown-unknown/native" RUSTC="/home/han/Project/rust/build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/home/han/Project/rust/build/tmp/extended-error-metadata" RUSTC_FORCE_UNSTABLE="1" RUSTC_HOST_FLAGS="-Zunstable-options --check-cfg=cfg(bootstrap) -Ctarget-feature=-crt-static -Clinker-flavor=gnu-lld-cc -Zunstable-options -Clinker=clang" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1/lib" RUSTC_LINK_STD_INTO_RUSTC_DRIVER="1" RUSTC_LINT_FLAGS="-Wrust_2018_idioms -Wunused_lifetimes -Dwarnings" RUSTC_REAL="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1/bin/rustc" RUSTC_SNAPSHOT="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/lib" RUSTC_STAGE="1" RUSTC_SYSROOT="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1" RUSTC_VERBOSE="1" RUSTC_WRAPPER="/home/han/Project/rust/build/bootstrap/debug/rustc" RUSTDOC="/home/han/Project/rust/build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="-Csymbol-mangling-version=legacy --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.88.0-dev -Clinker-flavor=gnu-lld-cc -Zunstable-options -Clinker=lld -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\") -Zcrate-attr=warn(rust_2018_idioms)" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="-Csymbol-mangling-version=legacy --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clinker-flavor=gnu-lld-cc -Zunstable-options -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" RUST_TEST_THREADS="32" WINAPI_NO_BUNDLED_LIBRARIES="1" __CARGO_DEFAULT_LIB_METADATA="devstd1.88.0" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/cargo" "build" "--target" "wasm32-unknown-unknown" "-Zbinary-dep-depinfo" "-j" "32" "-Zroot-dir=/home/han/Project/rust" "-v" "--release" "--features" "backtrace panic-unwind" "--manifest-path" "/home/han/Project/rust/library/sysroot/Cargo.toml" "-p" "alloc" "-p" "core" "-p" "panic_abort" "-p" "panic_unwind" "-p" "proc_macro" "-p" "std" "-p" "sysroot" "-p" "test" "-p" "unwind" "--message-format" "json-render-diagnostics"
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/han/Project/rust/build/bootstrap/debug/rustc /home/han/Project/rust/build/bootstrap/debug/rustc - --crate-name ___ --print=file-names -Csymbol-mangling-version=legacy '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clinker-flavor=gnu-lld-cc -Zunstable-options -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' --target wasm32-unknown-unknown --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)
  --- stdout
  ___.wasm
  lib___.rlib
  ___.wasm
  lib___.a
  /home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1
  off
  ___
  debug_assertions
  fmt_debug="full"
  overflow_checks
  panic="abort"
  proc_macro
  relocation_model="static"
  target_abi=""
  target_arch="wasm32"
  target_endian="little"
  target_env=""
  target_family="wasm"
  target_feature="bulk-memory"
  target_feature="multivalue"
  target_feature="mutable-globals"
  target_feature="nontrapping-fptoint"
  target_feature="reference-types"
  target_feature="sign-ext"
  target_has_atomic
  target_has_atomic="16"
  target_has_atomic="32"
  target_has_atomic="64"
  target_has_atomic="8"
  target_has_atomic="ptr"
  target_has_atomic_equal_alignment="16"
  target_has_atomic_equal_alignment="32"
  target_has_atomic_equal_alignment="64"
  target_has_atomic_equal_alignment="8"
  target_has_atomic_equal_alignment="ptr"
  target_has_atomic_load_store
  target_has_atomic_load_store="16"
  target_has_atomic_load_store="32"
  target_has_atomic_load_store="64"
  target_has_atomic_load_store="8"
  target_has_atomic_load_store="ptr"
  target_os="unknown"
  target_pointer_width="32"
  target_thread_local
  target_vendor="unknown"
  ub_checks

  Did not run successfully: exit status: 1
  LD_LIBRARY_PATH="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1/lib" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1/bin/rustc" "-" "--crate-name" "___" "--print=file-names" "-Csymbol-mangling-version=legacy" "--check-cfg=cfg(feature,values(any()))" "-Zunstable-options" "--check-cfg=cfg(bootstrap)" "-Zmacro-backtrace" "-Csplit-debuginfo=off" "-Cprefer-dynamic" "-Zinline-mir" "-Zinline-mir-preserve-debug" "-Zmir_strip_debuginfo=locals-in-tiny-functions" "-Clinker-flavor=gnu-lld-cc" "-Zunstable-options" "-Alinker-messages" "-Cembed-bitcode=yes" "-Cforce-frame-pointers=yes" "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" "--target" "wasm32-unknown-unknown" "--crate-type" "bin" "--crate-type" "rlib" "--crate-type" "dylib" "--crate-type" "cdylib" "--crate-type" "staticlib" "--crate-type" "proc-macro" "--print=sysroot" "--print=split-debuginfo" "--print=crate-name" "--print=cfg" "-Wwarnings" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "--sysroot" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1" "-Z" "force-unstable-if-unmarked"
  -------------

  --- stderr
  error: linker flavor `gnu-lld-cc` is incompatible with the current target
    |
    = note: compatible flavors are: wasm-lld, wasm-lld-cc, gcc, wasm-ld

  warning: dropping unsupported crate type `dylib` for target `wasm32-unknown-unknown`

  warning: dropping unsupported crate type `proc-macro` for target `wasm32-unknown-unknown`

  error: aborting due to 1 previous error; 2 warnings emitted

command did not execute successfully: cd "/home/han/Project/rust" && env -u MAKEFLAGS -u MFLAGS AR_wasm32_unknown_unknown="/usr/lib/llvm/20/bin/llvm-ar" CARGO_INCREMENTAL="0" CARGO_LOG="cargo::core::compiler::fingerprint=info" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_PROFILE_RELEASE_STRIP="false" CARGO_TARGET_DIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1-std" CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER="lld" CC_wasm32_unknown_unknown="clang" CFG_COMPILER_BUILD_TRIPLE="x86_64-unknown-linux-musl" CFG_COMPILER_HOST_TRIPLE="wasm32-unknown-unknown" CFG_RELEASE_CHANNEL="dev" CFLAGS_wasm32_unknown_unknown="" CXXFLAGS_wasm32_unknown_unknown="" CXX_wasm32_unknown_unknown="clang++" LIBC_CHECK_CFG="1" RANLIB_wasm32_unknown_unknown="/usr/lib/llvm/20/bin/llvm-ar s" REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/home/han/Project/rust/build/wasm32-unknown-unknown/native" RUSTC="/home/han/Project/rust/build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/home/han/Project/rust/build/tmp/extended-error-metadata" RUSTC_FORCE_UNSTABLE="1" RUSTC_HOST_FLAGS="-Zunstable-options --check-cfg=cfg(bootstrap) -Ctarget-feature=-crt-static -Clinker-flavor=gnu-lld-cc -Zunstable-options -Clinker=clang" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1/lib" RUSTC_LINK_STD_INTO_RUSTC_DRIVER="1" RUSTC_LINT_FLAGS="-Wrust_2018_idioms -Wunused_lifetimes -Dwarnings" RUSTC_REAL="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1/bin/rustc" RUSTC_SNAPSHOT="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/lib" RUSTC_STAGE="1" RUSTC_SYSROOT="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage1" RUSTC_VERBOSE="1" RUSTC_WRAPPER="/home/han/Project/rust/build/bootstrap/debug/rustc" RUSTDOC="/home/han/Project/rust/build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="-Csymbol-mangling-version=legacy --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.88.0-dev -Clinker-flavor=gnu-lld-cc -Zunstable-options -Clinker=lld -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\") -Zcrate-attr=warn(rust_2018_idioms)" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="-Csymbol-mangling-version=legacy --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clinker-flavor=gnu-lld-cc -Zunstable-options -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" RUST_TEST_THREADS="32" WINAPI_NO_BUNDLED_LIBRARIES="1" __CARGO_DEFAULT_LIB_METADATA="devstd1.88.0" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/cargo" "build" "--target" "wasm32-unknown-unknown" "-Zbinary-dep-depinfo" "-j" "32" "-Zroot-dir=/home/han/Project/rust" "-v" "--release" "--features" "backtrace panic-unwind" "--manifest-path" "/home/han/Project/rust/library/sysroot/Cargo.toml" "-p" "alloc" "-p" "core" "-p" "panic_abort" "-p" "panic_unwind" "-p" "proc_macro" "-p" "std" "-p" "sysroot" "-p" "test" "-p" "unwind" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions