While building ceph, the complier complains:
=================================================================
[ 86%] Building CXX object src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/test_mon_memory_target.cc.o
/root/ceph/src/test/mon/test_mon_memory_target.cc: In int main(int, :
/root/ceph/src/test/mon/test_mon_memory_target.cc:66:16: was not declared in this scope
66 | auto stdev = sqrt(sump / results.size());
| ^~~~
make[2]: *** [src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/build.make:63: src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/test_mon_memory_target.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:15575: src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
=================================================================
This's caused by lack of header cmath which is required by
std::sqrt().
Fix it by add the header then build continues.
Fixes: https://tracker.ceph.com/issues/41739
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
(cherry picked from commit
9acfb351a3965c28d390822fd8f2ec5675b29064)
#include <algorithm>
+#include <cmath>
#include <iostream>
#include <string>
#include <numeric>