It looks like there has been an update to Galera that has broken the the build process. The errors suggest it's missing the same libatomic library as MariaDB.
A quick stab in the dark would be to add the following line:
list(APPEND GALERA_UNIT_TEST_LIBS atomic)
On line 26 in the cmake/check.cmake file:
https://github.com/MariaDB/galera/blob/mariadb-4.x/cmake/check.cmake#L26
Then rebuild from scratch by using the scratch command:
./scripts/build.sh --scratch -p -j 1
If that doesn't work then it would need further investigation which I will try and do when I have some spare time,