Can't find std::atomic while building built-in LLVM

ROOT Version: 6.22/06
Platform: Debian 10/Linux
Compiler: 8.3.0

Build of ROOT from source dies while configuring built-in LLVM.

The error message is:

CMake Error at interpreter/llvm/src/cmake/modules/CheckAtomic.cmake:49 (message):
Host compiler must support std::atomic!

I’ve seen another post on this forum

with the same error, but I’ve checked that the compiler can use std::atomic. I extracted the test program used in CMake, compiled and ran it without error.

I added some debug messages to the CMake file to print the INCLUDE_DIRECTORIES cmake variable. It is empty. I believe it ought to have system include directories.

A similar build on Debian 11 Bullseye using GCC 11.2.0 also fails with the same error.

ROOT 6.20/04 builds without any problems.

Does anyone have any advice?

@oshadura any ideas?

@eguiraud, as I remember, are you using Debian, can you check, please if you can reproduce it or maybe advise something to be installed?

on my Debian 10.7 workstation I can run the cmake configuration and start compiling ROOT 6.22/06 just fine (I’m now at 40%).

Is your system up to date? And are you sure that the correct compiler/compiler headers are picked up? gcc 8 definitely supports std::atomic.

Can you share the full cmake configuration output?


Enrico, thank you for trying this out!

Please find attached the cmake output, and the log files mentioned at the end of the output.

I have just looked at the log files for the first time. CMakeError.log shows what looks like badly formed options passed to the compiler when compiling the atomics test code as part of the CMake setup for LLVM.

At the moment I’m not sure what I did to cause it or what I could do to fix it. There’s no obvious line in the source to change.


CMakeError.log.txt (31.7 KB) CMakeOutput.log.txt (200.2 KB) root_cmake_output_buster.txt (19.3 KB)

I’m afraid there is something broken in your environment (not sure what, maybe @oshadura or @Axel have an idea).

I just tried the following in a fresh Debian 10.7 Docker container and the cmake configuration did not complain about std::atomic support (I tried to use the same cmake configuration options that you use):

$ apt -y update && apt -y upgrade && apt -y install dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev python  libmariadb-dev  gfortran libpcre3-dev xlibmesa-glu-dev libglew1.5-dev libftgl-dev  libfftw3-dev libcfitsio-dev graphviz-dev libavahi-compat-libdnssd-dev libldap2-dev python-dev libxml2-dev libkrb5-dev libgsl0-dev libqt4-dev  libssl-dev git python3 python3-dev                                               
$ git clone --branch=v6-22-06 --depth=1 root/root_src
$ mkdir root/root_build && cd root/root_build
$ cmake -DCMAKE_CXX_STANDARD=11 -Druntime_cxxmodules=OFF  -Dthread=ON -Dshadowpw=ON -Dpythia8=ON -Dr=ON -Dminuit2=ON -Dmathmore=ON -Ddataframe=ON -Ddcache=ON -Dfortran=ON -Dgfal=ON -Dgsl_shared=ON -Dgviz=ON -Dmysql=ON -Dodbc=ON -Dopengl=ON -Dpgsql=ON -Dsoversion=ON -Dtmva-rmva=ON -Dunuran=ON -Dvmc=ON -Dxrootd=ON -Dbuiltin_xrootd=ON -Dbuiltin_gsl=OFF -Dgnuinstall=ON -Dimt=OFF -Ddavix=ON -Dmemstat=ON -Dbuiltin_vdt=OFF -Dvdt=ON -Dbuiltin_llvm=ON -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../root_src



Thank you for trying it out. This is helpful. I will find out what’s wrong with my setup and report back here.


I should have mentioned before that I was using pbuilder via cowbuilder to build a package.

pbuilder automatically adds some C++ flags that are the source of the problem.

this line added to the top of debian/rules solves the problem:

export DEB_BUILD_MAINT_OPTIONS=hardening=-format

These options perform some security checks on format strings. It seems that the options themselves weren’t the problem, but the option string is mangled when trying to build the atomics test.

Enrico, thanks again for your help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.