Skip to content

cc_common_link is broken in rust 1.87.0 #3459

Description

@abezukor

Compiling with cc common link is gives the following error when using rust 1.87.0

ERROR: /home/abe/.cache/bazel/_bazel_abe/827f63e25b315dd064e3058497da15dd/external/rules_rust+/util/process_wrapper/BUILD.bazel:31:36: Linking external/rules_rust+/util/process_wrapper/process_wrapper [for tool] failed: (Exit 1): gcc failed: error executing CppLink command (from target @@rules_rust+//util/process_wrapper:process_wrapper) /usr/bin/gcc @bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/util/process_wrapper/process_wrapper-0.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ld.lld: error: undefined symbol: __rustc::__rust_dealloc
>>> referenced by alloc.rs:113 (library/alloc/src/alloc.rs:113)
>>>               alloc-c7b16bb34ad937e6.alloc.4810a64b00f2b3b7-cgu.0.rcgu.o:(core::ptr::drop_in_place$LT$alloc..string..String$GT$::h1891d42eb8d68d4d) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c7b16bb34ad937e6.a
>>> referenced by gimli.16f37c71821a4789-cgu.0
>>>               gimli-0242466ae973a482.gimli.16f37c71821a4789-cgu.0.rcgu.o:(alloc::collections::btree::node::Handle$LT$alloc..collections..btree..node..NodeRef$LT$alloc..collections..btree..node..marker..Mut$C$K$C$V$C$alloc..collections..btree..node..marker..Leaf$GT$$C$alloc..collections..btree..node..marker..KV$GT$::split::h9f8b8b63bff91341) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-0242466ae973a482.a
>>> referenced by alloc.rs:113 (library/alloc/src/alloc.rs:113)
>>>               panic_unwind-9832433a93414fcc.panic_unwind.bd2a812479e30d2d-cgu.0.rcgu.o:(core::ptr::drop_in_place$LT$panic_unwind..imp..Exception$GT$::h6802c1014e463d96) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-9832433a93414fcc.a
>>> referenced 1040 more times

ld.lld: error: undefined symbol: __rustc::__rust_realloc
>>> referenced by alloc.rs:133 (library/alloc/src/alloc.rs:133)
>>>               alloc-c7b16bb34ad937e6.alloc.4810a64b00f2b3b7-cgu.0.rcgu.o:(alloc::raw_vec::finish_grow::hbf22bc34c9e458e7) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c7b16bb34ad937e6.a
>>> referenced by gimli.16f37c71821a4789-cgu.0
>>>               gimli-0242466ae973a482.gimli.16f37c71821a4789-cgu.0.rcgu.o:(alloc::raw_vec::finish_grow::hafdb4f4925013357) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-0242466ae973a482.a
>>> referenced by alloc.rs:133 (library/alloc/src/alloc.rs:133)
>>>               alloc-c7b16bb34ad937e6.alloc.4810a64b00f2b3b7-cgu.0.rcgu.o:(alloc::ffi::c_str::CString::_from_vec_unchecked::h6fd1f8c4256369f7) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c7b16bb34ad937e6.a
>>> referenced 15 more times

ld.lld: error: undefined symbol: __rustc::__rust_alloc
>>> referenced by mod.rs:0 (library/alloc/src/raw_vec/mod.rs:0)
>>>               alloc-c7b16bb34ad937e6.alloc.4810a64b00f2b3b7-cgu.0.rcgu.o:(alloc::raw_vec::finish_grow::hbf22bc34c9e458e7) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c7b16bb34ad937e6.a
>>> referenced by alloc.rs:93 (library/alloc/src/alloc.rs:93)
>>>               alloc-c7b16bb34ad937e6.alloc.4810a64b00f2b3b7-cgu.0.rcgu.o:(_$LT$$RF$str$u20$as$u20$alloc..ffi..c_str..CString..new..SpecNewImpl$GT$::spec_new_impl::he67d371a567108ea) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c7b16bb34ad937e6.a
>>> referenced by alloc.rs:93 (library/alloc/src/alloc.rs:93)
>>>               panic_unwind-9832433a93414fcc.panic_unwind.bd2a812479e30d2d-cgu.0.rcgu.o:(__rustc::__rust_start_panic) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-9832433a93414fcc.a
>>> referenced 140 more times

ld.lld: error: undefined symbol: __rustc::__rust_alloc_error_handler
>>> referenced by alloc.rs:405 (library/alloc/src/alloc.rs:405)
>>>               alloc-c7b16bb34ad937e6.alloc.4810a64b00f2b3b7-cgu.0.rcgu.o:(alloc::alloc::handle_alloc_error::he8b8c0d2be2abab7) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c7b16bb34ad937e6.a

ld.lld: error: undefined symbol: __rustc::__rust_alloc_zeroed
>>> referenced by gimli.16f37c71821a4789-cgu.0
>>>               gimli-0242466ae973a482.gimli.16f37c71821a4789-cgu.0.rcgu.o:(alloc::raw_vec::RawVecInner$LT$A$GT$::try_allocate_in::h6fcaf43c21d8069d) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-0242466ae973a482.a
>>> referenced by alloc.rs:176 (library/alloc/src/alloc.rs:176)
>>>               std-769ac7a9899f22f3.std.ab9b65b5f5dd2f44-cgu.0.rcgu.o:(std::backtrace_rs::symbolize::gimli::stash::Stash::allocate::h4ab823c4eb5e69be) in archive bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-769ac7a9899f22f3.a
collect2: error: ld returned 1 exit status
Target //:main failed to build

I am guessing it is caused by rust-lang/rust#127173.
Minimized example is available at https://github.com/abezukor/rules_rust/tree/55db7d8bfdcdfac0b1627dcdc3b2066d81f356d6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions