Skip to content

1.87 build fails with LLVM 19 #141353

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
bbhtt opened this issue May 21, 2025 · 10 comments
Closed

1.87 build fails with LLVM 19 #141353

bbhtt opened this issue May 21, 2025 · 10 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@bbhtt
Copy link

bbhtt commented May 21, 2025

1.87 build fails with LLVM 19. Does 1.87 require LLVM 20+ or it's a bug?

        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:879:12: error: 'llvm::COFF::Arm64XFixupType' has not been declared
          879 |   void add(llvm::COFF::Arm64XFixupType type, uint8_t size,
              |            ^~~~
        /buildstream-build/src/llvm-project/lld/COFF/InputFiles.cpp: In member function 'std::optional<lld::coff::Symbol*> lld::coff::ObjFile::createDefined(llvm::object::COFFSymbolRef, std::vector<const llvm::object::coff_aux_section_definition*>&, bool&)':
        /buildstream-build/src/llvm-project/lld/COFF/InputFiles.cpp:770:11: error: 'class llvm::object::COFFSymbolRef' has no member named 'isEmptySectionDeclaration'
          770 |   if (sym.isEmptySectionDeclaration()) {
              |           ^~~~~~~~~~~~~~~~~~~~~~~~~
        In file included from /usr/include/c++/14.2.0/i686-unknown-linux-gnu/bits/c++allocator.h:33,
                         from /usr/include/c++/14.2.0/bits/allocator.h:46,
                         from /usr/include/c++/14.2.0/string:43,
                         from /usr/include/llvm/ADT/Hashing.h:56,
                         from /buildstream-build/src/llvm-project/lld/include/lld/Common/LLVM.h:19,
                         from /buildstream-build/src/llvm-project/lld/include/lld/Common/ErrorHandler.h:71,
                         from /buildstream-build/src/llvm-project/lld/COFF/Config.h:12,
                         from /buildstream-build/src/llvm-project/lld/COFF/InputFiles.h:12,
                         from /buildstream-build/src/llvm-project/lld/COFF/InputFiles.cpp:9:
        /usr/include/c++/14.2.0/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = lld::coff::Arm64XDynamicRelocEntry; _Args = {int&, unsigned char&, lld::coff::Arm64XRelocVal&, lld::coff::Arm64XRelocVal&}; _Tp = lld::coff::Arm64XDynamicRelocEntry]':
        /usr/include/c++/14.2.0/bits/alloc_traits.h:534:17:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = lld::coff::Arm64XDynamicRelocEntry; _Args = {int&, unsigned char&, lld::coff::Arm64XRelocVal&, lld::coff::Arm64XRelocVal&}; _Tp = lld::coff::Arm64XDynamicRelocEntry; allocator_type = std::allocator<lld::coff::Arm64XDynamicRelocEntry>]'
          534 |           __a.construct(__p, std::forward<_Args>(__args)...);
              |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/include/c++/14.2.0/bits/vector.tcc:117:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, unsigned char&, lld::coff::Arm64XRelocVal&, lld::coff::Arm64XRelocVal&}; _Tp = lld::coff::Arm64XDynamicRelocEntry; _Alloc = std::allocator<lld::coff::Arm64XDynamicRelocEntry>; reference = lld::coff::Arm64XDynamicRelocEntry&]'
          117 |             _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
              |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          118 |                                      std::forward<_Args>(__args)...);
              |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:881:30:   required from here
          881 |     arm64xRelocs.emplace_back(type, size, offset, value);
              |     ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/include/c++/14.2.0/bits/new_allocator.h:191:11: error: no matching function for call to 'lld::coff::Arm64XDynamicRelocEntry::Arm64XDynamicRelocEntry(int&, unsigned char&, lld::coff::Arm64XRelocVal&, lld::coff::Arm64XRelocVal&)'
          191 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
              |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:854:7: note: candidate: 'lld::coff::Arm64XDynamicRelocEntry::Arm64XDynamicRelocEntry()'
          854 | class Arm64XDynamicRelocEntry {
              |       ^~~~~~~~~~~~~~~~~~~~~~~
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:854:7: note:   candidate expects 0 arguments, 4 provided
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:854:7: note: candidate: 'constexpr lld::coff::Arm64XDynamicRelocEntry::Arm64XDynamicRelocEntry(const lld::coff::Arm64XDynamicRelocEntry&)'
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:854:7: note:   candidate expects 1 argument, 4 provided
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:854:7: note: candidate: 'constexpr lld::coff::Arm64XDynamicRelocEntry::Arm64XDynamicRelocEntry(lld::coff::Arm64XDynamicRelocEntry&&)'
        /buildstream-build/src/llvm-project/lld/COFF/Chunks.h:854:7: note:   candidate expects 1 argument, 4 provided
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 21, 2025
@moxian

This comment has been minimized.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 21, 2025
@dianqk
Copy link
Member

dianqk commented May 22, 2025

This looks like an internal LLVM build error.

@onur-ozkan
Copy link
Member

We are using LLVM 20 since this, but LLVM 19 should work too, I guess... I haven't tested yet.

@onur-ozkan onur-ozkan removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 22, 2025
@bbhtt
Copy link
Author

bbhtt commented May 22, 2025

Building with LLVM 20 works for me too, but LLVM is frozen to 19 in one of our stable branches.

@nikic
Copy link
Contributor

nikic commented May 22, 2025

My best guess is that you're using some broken build configuration that tries to use an external LLVM 19 while also building an LLVM 20 LLD? Can you please share your config file?

@bbhtt
Copy link
Author

bbhtt commented May 23, 2025

@nikic
Copy link
Contributor

nikic commented May 23, 2025

The config looks reasonable to me. Maybe there's a bootstrap bug that makes this comment not true:

rust/bootstrap.example.toml

Lines 720 to 725 in e7f4317

# Indicates whether LLD will be compiled and made available in the sysroot for rustc to execute, and
# whether to set it as rustc's default linker on `x86_64-unknown-linux-gnu`. This will also only be
# when *not* building an external LLVM (so only when using `download-ci-llvm` or building LLVM from
# the in-tree source): setting `llvm-config` in the `[target.x86_64-unknown-linux-gnu]` section will
# make this default to false.
#lld = false in all cases, except on `x86_64-unknown-linux-gnu` as described above, where it is true
But explicitly setting lld = false should probably fix it?

@bbhtt
Copy link
Author

bbhtt commented May 23, 2025

But explicitly setting lld = false should probably fix it?

That seems to have worked

https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/merge_requests/26458

@onur-ozkan
Copy link
Member

On master, since #139853, you won't be able to compile in-tree lld with external LLVM. So this error isn't reproducible on master today.

@bbhtt
Copy link
Author

bbhtt commented May 23, 2025

I see, feel free to close then if there is a check against this mixed behaviour. We also switched to our LLVM's lld in the master branch.

@onur-ozkan onur-ozkan closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

6 participants