Root 6.18.04 fails to compile on Raspbian 10 (with solution)

Hello,

Just in case somebody else encounters this problem:

Compiling ROOT with gcc 8.3 on a raspberry pi 4 using raspbian (based on debian 10 buster) results in the following compile issue:

[ 79%] Linking CXX shared library …/…/lib/libRIO.so
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFilePrefetch.cxx.o: in function TFilePrefetch::GetBlockFromCache(char const*, int)': /usr/include/c++/8/bits/atomic_base.h:312: undefined reference to__atomic_fetch_add_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::ReadBuffer(char*, int) [clone .part.80]': /usr/include/c++/8/bits/atomic_base.h:312: undefined reference to__atomic_fetch_add_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::ReadBuffer(char*, long long, int)': /usr/include/c++/8/bits/atomic_base.h:312: undefined reference to__atomic_fetch_add_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::ReadBuffers(char*, long long*, int*, int)': /usr/include/c++/8/bits/atomic_base.h:320: undefined reference to__atomic_fetch_sub_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::WriteBuffer(char const*, int)': /usr/include/c++/8/bits/atomic_base.h:312: undefined reference to__atomic_fetch_add_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::GetFileBytesRead()': /usr/include/c++/8/bits/atomic_base.h:396: undefined reference to__atomic_load_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::GetFileBytesWritten()': /usr/include/c++/8/bits/atomic_base.h:396: undefined reference to__atomic_load_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::SetFileBytesRead(long long)': /usr/include/c++/8/bits/atomic_base.h:374: undefined reference to__atomic_store_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::SetFileBytesWritten(long long)': /usr/include/c++/8/bits/atomic_base.h:374: undefined reference to__atomic_store_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::GetFileCounter()': /usr/include/c++/8/bits/atomic_base.h:396: undefined reference to__atomic_load_8’
/usr/bin/ld: CMakeFiles/RIOObjs.dir/src/TFile.cxx.o: in function TFile::IncrementFileCounter()': /usr/include/c++/8/bits/atomic_base.h:514: undefined reference to__atomic_fetch_add_8’
collect2: error: ld returned 1 exit status
make[2]: *** [io/io/CMakeFiles/RIO.dir/build.make:139: lib/libRIO.so.6.18.04] Error 1
make[1]: *** [CMakeFiles/Makefile2:22736: io/io/CMakeFiles/RIO.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

The solution is to add the following cmake option:
-DCMAKE_SHARED_LINKER_FLAGS=’-latomic’

Best,
Andreas


ROOT Version: 6.18.04
Platform: Raspbian 10
Compiler: gcc 8.3.0


See https://github.com/root-project/root/pull/4561

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