Error building CMake on Raspbian bullseye

Hi,

I’m trying to build 3.30.0 from source on a Raspbian bullseye system (I need a newer version of CMake than is supplied with bullseye, which is 3.18), and it fails with “undefined reference to `__atomic_store_8’”. I understand that this is probably a linker issue, but I have no idea how to fix it. Can someone provide some guidance?

Thanks.

Can you give a little error message, at least to see which source file or external library the error is coming from?

Yes, sorry about that. Here’s the first instance:

/usr/bin/ld: libCMakeLib.a(cmDebuggerAdapter.cxx.o): in function `std::_Function_handler<void (void const*, std::function<void (dap::TypeInfo const*, void const*)> const&, std::function<void (dap::TypeInfo const*, dap::Error const&)> const&), dap::Session::registerHandler<cmDebugger::cmDebuggerAdapter::cmDebuggerAdapter(std::shared_ptr<cmDebugger::cmDebuggerConnection>, std::optional<std::shared_ptr<dap::Writer> >)::{lambda(dap::NextRequest const&)#10}, dap::NextRequest>(std::integral_constant::SignatureOf&&)::{lambda(void const*, std::function<void (dap::TypeInfo const*, void const*)> const&, std::function<void (dap::TypeInfo const*, dap::Error const&)> const&)#1}>::_M_invoke(std::_Any_data const&, void const*&&, std::function<void (dap::TypeInfo const*, void const*)> const&, std::function<void (dap::TypeInfo const*, dap::Error const&)> const&)':
cmDebuggerAdapter.cxx:(.text+0x998): undefined reference to `__atomic_store_8'

Issue 21174 seems quite relevant, although that issue is about compiling user projects, not CMake itself. Potentially we need to add a try_compile() to CMake’s own CMakeLists.txt files to handle detection of whether to link libatomic or not.

Thanks. Should I add a comment to that issue. or should this get a new issue?

Probably a separate issue, but cross-reference 21174 since there will be some overlap and useful context.

2 posts were split to a new topic: gitlab account creation

Created issue #26307.