ROOT on Raspberry Pi

Hi there,

I’m currently installing ROOT 6.24.02 on a Raspberry Pi 4 running Raspbian 10.10. I’ve seen this ROOT forum post addressing the problems with atomic_fetch_add_8, however I am still having problems. Here are the steps I’ve taken with the install:

  1. Install required dependencies:
    sudo apt-get install dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev python libssl-dev

  2. Install optional dependencies:
    sudo apt-get install gfortran libpcre3-dev xlibmesa-glu-dev libglew1.5-dev libftgl-dev libmariadb-dev libfftw3-dev libcfitsio-dev graphviz-dev libavahi-compat-libdnssd-dev libldap2-dev python-dev libxml2-dev libkrb5-dev libgsl0-dev libqt4-dev

  3. After unpacking the source code, I execute in the build directory:
    cmake -DCMAKE_INSTALL_PREFIX=…/install …/src -DCMAKE_SHARED_LINKER_FLAGS=’-latomic’

  4. And then build:
    cmake --build . --target install -j4

Everything goes OK until this point, where I still get errors with atomic:
[ 76%] Linking CXX executable src/rootcling_stage1
c++: error: ’-latomic’: No such file or directory
make[2]: *** [core/metacling/src/CMakeFiles/Cling.dir/build.make:195: lib/libCling.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:26860: core/metacling/src/CMakeFiles/Cling.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[ 76%] Built target BaseTROOT
/usr/bin/ld: …/foundation/CMakeFiles/Foundation_Stage1.dir/src/RLogger.cxx.o: in function ROOT::Experimental::RLogManager::Emit(ROOT::Experimental::RLogEntry const&)': RLogger.cxx:(.text+0x978): undefined reference to __atomic_fetch_add_8’
/usr/bin/ld: RLogger.cxx:(.text+0x9ac): undefined reference to __atomic_fetch_add_8' /usr/bin/ld: RLogger.cxx:(.text+0x9d4): undefined reference to __atomic_fetch_add_8’
/usr/bin/ld: RLogger.cxx:(.text+0x9f4): undefined reference to __atomic_fetch_add_8' /usr/bin/ld: RLogger.cxx:(.text+0xa14): undefined reference to __atomic_fetch_add_8’
/usr/bin/ld: …/foundation/CMakeFiles/Foundation_Stage1.dir/src/RLogger.cxx.o:RLogger.cxx:(.text+0xa54): more undefined references to `__atomic_fetch_add_8’ follow
collect2: error: ld returned 1 exit status
make[2]: *** [core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/build.make:228: core/rootcling_stage1/src/rootcling_stage1] Error 1
make[1]: *** [CMakeFiles/Makefile2:27859: core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

I must be missing something obvious – is there something else to install? Any help would be greatly appreciated! Hopefully with the solution, this post can serve as a more verbose guide for future users.


ROOT Version: 6.24.02
Platform: Raspbian 10.10
Compiler: GNU 8.3


I don’t know what changed, the cmake fragment in ROOT or the location of libatomic on Pi, but it’s not found anymore with 6.24 during the check when running cmake and thus not added. One way around it, is to add it explicitly to LD_FLAGS, eg.:

$ LDFLAGS="-L/usr/lib/gcc/arm-linux-gnueabihf/8/ -latomic" cmake ../root ...
$ LDFLAGS="-L/usr/lib/gcc/arm-linux-gnueabihf/8/ -latomic" make -j ...

where obviously that path given to -L should be wherever libatomic is located on your system. That way, the check in the fragment succeeds and -latomic is appropriately added during the build.

2 Likes

Hi @SaadShaikh ,
I think @Axel has some experience building ROOT on Raspbian, let’s see if he knows :slight_smile:

Cheers,
Enrico

1 Like

This did the trick for me (after wiping all the previous build contents so that CMake wasn’t remembering old things). For completeness, I replaced steps 3 and 4 in my original post with:

LDFLAGS="-L/usr/lib/gcc/arm-linux-gnueabihf/8/ -latomic" cmake -DCMAKE_INSTALL_PREFIX=…/install …/src

LDFLAGS="-L/usr/lib/gcc/arm-linux-gnueabihf/8/ -latomic" cmake --build . --target install -j4

I then added the line:
. /home/pi/ROOT/install/bin/thisroot.sh
to my .bashrc in /home/pi to source ROOT every time a new terminal is opened.

Many thanks for your help @wlav and @eguiraud! :slight_smile:

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