clickhouse编译报错fatal error: sys/random.h: No such file or directory

具体报错信息如下:

Determining if the include file sys/random.h exists failed with the following output:
Change Dir: /data/make/ClickHouse/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_fbfb8/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_fbfb8.dir/build.make CMakeFiles/cmTC_fbfb8.dir/build
gmake[1]: Entering directory `/data/make/ClickHouse/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_fbfb8.dir/CheckIncludeFile.c.o
/opt/rh/devtoolset-9/root/usr/bin/gcc   -pipe -msse4.1 -msse4.2 -mpopcnt  -Wall  -Werror    -o CMakeFiles/cmTC_fbfb8.dir/CheckIncludeFile.c.o   -c /data/make/ClickHouse/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/data/make/ClickHouse/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: sys/random.h: No such file or directory
    1 | #include <sys/random.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
gmake[1]: *** [CMakeFiles/cmTC_fbfb8.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/data/make/ClickHouse/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_fbfb8/fast] Error 2
已邀请:

空心菜 - 心向阳光,茁壮成长

这个错误是因为libc的版本太古老了,解决方法是升级glibc的版本: https://stackoverflow.com/questions/30800331/getrandom-syscall-in-c-not-found

在2017年的glibc 2.25版本中增加了头文件,详情:https://sourceware.org/legacy-ml/libc-alpha/2017-02/msg00079.html

在centos上安装最新的glibc的教程参考文章:https://blog.csdn.net/zhangpeterx/article/details/96116219

参考 

要回复问题请先登录注册