Repository navigation
LLVM recursion stack overflow when buildin fresh #150691
Description
Activity
- addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Jan 5, 2026 So to further explain what's happening:
- The
andatool callsrpmbuild, which parses and execute instructions in the RPM spec file. - The
%cargo_buildmacro is invoked. This is equivalent to/usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn' /usr/bin/cargo build -j${RPM_BUILD_NCPUS} -Z avoid-dev-deps --profile rpm. - However
rpmbuildwould define other environment variables automatically based on other factors that I would not like to explain here. - Once it fails, if you run
anda, the build process starts all over again, removing previous build files. - The build files are not removed after it fails. You can access them at
/root/rpmbuild/BUILD/.
- The
- addedI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
on Jan 5, 2026 - addedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Jan 5, 2026 - addedS-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.
on Jan 5, 2026 About the issue itself: Since libLLVM has been stripped of all symbols, it's impossible to figure out anything about what could have caused the issue and whether this may be a known bug. Might be infinite recursion, might just be deeply nested recursion that hits the stack limit.
5 remaining items
@workingjubilee So this is a Fedora packaging issue, not an LLVM limitation.
No. The bug likely not anything Fedora-specific. It's just that Fedora's packaging makes it harder to quickly infer whether this could be related to another bug. As pointed out by @saethlin, this issue will need to be fully reproduced and debugged by someone to figure out what's really going on.
- addedA-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
on Jan 5, 2026 I tried to reproduce the issue since you posted a convenient dockerfile, but it does not work for me:
0.293 Building RPMs in anda-build/rpm 0.326 rpmbuild │ warning: Downloading https://github.com/sinelaw/fresh/archive/refs/tags/v0.1.70.tar.gz to /packages/anda/langs/rust/fresh/v0.1.70.tar.gz 1.183 rpmbuild │ setting SOURCE_DATE_EPOCH=1766793600 1.230 rpmbuild │ error: Failed build dependencies: 1.230 rpmbuild │ cargo is needed by fresh-0.1.70-1.fcrawhide.x86_64 1.230 rpmbuild │ cargo-rpm-macros is needed by fresh-0.1.70-1.fcrawhide.x86_64 1.230 rpmbuild │ pkgconfig(icu-uc) is needed by fresh-0.1.70-1.fcrawhide.x86_64 1.230 rpmbuild │ 1.230 rpmbuild │ RPM build warnings: 1.230 rpmbuild │ Downloading https://github.com/sinelaw/fresh/archive/refs/tags/v0.1.70.tar.gz to /packages/anda/langs/rust/fresh/v0.1.70.tar.gz 1.247 2026-01-05T20:16:20.364498Z INFO anda::util: Command exited with status: exit status: 11 1.247 at src/util.rs:179 1.247 1.248 Error: 1.248 0: Failed to build RPMs 1.248 1: Command exited with status: exit status: 11 1.248 1.248 Location: 1.248 src/util.rs:180 1.248 1.248 Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. 1.248 Run with RUST_BACKTRACE=full to include source snippets.What do I need to do to actually reproduce the problem? Looking at the build log on your PR in GHA, I found out that the built program is https://github.com/sinelaw/fresh (this would have been helpful to clarify).
When it comes to debugging these issues, the most important thing is always to get rid of as many tools and wrappers as possible and reproduce the issue with a setup that's as simple as possible, so I would advise trying that.
- changed the title
[-]recursion stack overflow with sccache[/-][+]LLVM recursion stack overflow with sccache when buildin fresh[/+]on Jan 5, 2026 So turns out I forgot to test my dockerfile (thought I did); updated it to pull build dependencies too.
edit 1: I am now trying to remove the entire rpmbuild and anda stack
edit 2: still trying to reduce the stack, but seems like sccache is not at fault
removed most of the rpm stuff and sccache from the Dockerfile
also, for the debug symbols, if you open gdb and analyze it it will automatically download the symbols iirc
- changed the title
[-]LLVM recursion stack overflow with sccache when buildin fresh[/-][+]LLVM recursion stack overflow when buildin fresh[/+]on Jan 6, 2026 also, for the debug symbols, if you open gdb and analyze it it will automatically download the symbols iirc
Yes, because gdb uses
libdebuginfod.so, and Fedora hosts such a server.For symbols only, rpm-built binaries also include so-called "mini debuginfo" in the
.gnu_debugdatasection, which would be nice to support in Rust backtraces -- rust-lang/backtrace-rs#430.Oh, that's on me to fix! Got it.
Yes, loading
libdebuginfod.sointo random Rust binaries seems suboptimal as a way of extracting traces. I'm lazy and want my information without even startinggdb, which is why I instead write... software... to extract information that gdb does... look, I know it doesn't make sense!Sure, I agree that
libdebuginfod.soshould not be introduced everywhere, and especially not in a process that's about to die. At least.gnu_debugdatais local, but it's not an allocated section, so you do still have to open it from disk. I guess that may make it no-go for rustc's SIGSEGV handler too.You still get a core dump though, right? Then you can investigate with fuller tooling afterward.
("you" != @workingjubilee in particular 😉 )Here's an attempt to decode the top comment's addresses, assuming current
llvm-libs-21.1.8-1.fc44.x86_64was used:$ eu-addr2line -Cfi -e /lib64/libLLVM.so.21.1 0x46a5e55 llvm::LiveInterval* const* llvm::SmallVectorTemplateCommon<llvm::LiveInterval*, void>::reserveForParamAndGetAddressImpl<llvm::SmallVectorTemplateBase<llvm::LiveInterval*, true> >(llvm::SmallVectorTemplateBase<llvm::LiveInterval*, true>*, llvm::LiveInterval* const&, unsigned long) inlined at /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/SmallVector.h:538:9 in (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/SmallVector.h:233:9 llvm::SmallVectorTemplateBase<llvm::LiveInterval*, true>::reserveForParamAndGetAddress(llvm::LiveInterval*&, unsigned long) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/SmallVector.h:538:9 llvm::SmallVectorImpl<llvm::LiveInterval*>::append(unsigned long, llvm::LiveInterval*) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/SmallVector.h:694:29 llvm::SmallVectorImpl<llvm::LiveInterval*>::resize(unsigned long, llvm::LiveInterval*) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/SmallVector.h:661:11 llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::resize(unsigned long) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/IndexedMap.h:62:16 llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::grow(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/ADT/IndexedMap.h:72:9 llvm::LiveIntervals::createEmptyInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/LiveIntervals.h:151:22 llvm::LiveIntervals::createAndComputeVirtRegInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/LiveIntervals.h:158:24 llvm::LiveIntervals::getInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/LiveIntervals.h:137:12 (anonymous namespace)::RegisterCoalescer::joinVirtRegs(llvm::CoalescerPair&) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/RegisterCoalescer.cpp:3671:28 (anonymous namespace)::RegisterCoalescer::joinIntervals(llvm::CoalescerPair&) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/RegisterCoalescer.cpp:3849:50 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&, llvm::SmallPtrSetImpl<llvm::MachineInstr*>&) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/RegisterCoalescer.cpp:2166:8 (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/RegisterCoalescer.cpp:4066:20$ eu-addr2line -Cfi -e /lib64/libLLVM.so.21.1 0x46a60d4 llvm::MCRegister::isPhysicalRegister(unsigned int) inlined at /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/Register.h:56:12 in (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/MC/MCRegister.h:59:36 llvm::Register::isPhysicalRegister(unsigned int) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/Register.h:56:12 llvm::Register::isPhysical() const /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/Register.h:78:46 llvm::LiveIntervals::createInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/LiveIntervals.cpp:224:22 llvm::LiveIntervals::createEmptyInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/LiveIntervals.h:153:16 llvm::LiveIntervals::createAndComputeVirtRegInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/LiveIntervals.h:158:24 llvm::LiveIntervals::getInterval(llvm::Register) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/include/llvm/CodeGen/LiveIntervals.h:137:12 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&, llvm::SmallPtrSetImpl<llvm::MachineInstr*>&) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/RegisterCoalescer.cpp:2141:33 (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) /usr/src/debug/llvm-21.1.8-1.fc44.x86_64/llvm/lib/CodeGen/RegisterCoalescer.cpp:4066:20I think your gist also needs the cargo-config file that you're copying in.
totally forgot about that, added that into the gist too.
If you are very energetic and wants to do something very challenging, well here comes a very difficult-to-repro issue:
https://gist.github.com/madonuko/8cb7959b33f9f31e8221f23d5e2a95a9
I know rust, but I didn't write the code, I just tried to package this into terrapkg/packages#8917.
Meta
rustc --version --verbose:Backtrace