编译gnutls3.5.3,make时报错:
... rnd-linux.c: In function 'have_getrandom': rnd-linux.c:59:42: error: 'SYS_getrandom' undeclared (first use in this function) ...
参考:https://lists.gnupg.org/pipermail/gnutls-devel/2016-August/008126
** libgnutls: Use getrandom where available via the syscall interface.
This works around an issue of not-using getrandom even if it exists
since glibc doesn’t declare such function.
参考:http://gnutls.org/manual/gnutls
GnuTLS requires the following system calls to be available for its proper operation. nanosleep time gettimeofday clock_gettime getrusage getpid send recv sendmsg read (to read from /dev/urandom) getrandom (this is Linux-kernel specific) poll
参考:https://github.com/aria2/aria2/issues/346
参考:https://github.com/aria2/aria2/commit/fd6f5ebc32eb5f74501e11b7e519642ee95d49f0
AC_MSG_CHECKING([for getrandom linux syscall interface]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <sys/syscall.h> #include <linux/random.h> ]], [[ int x = GRND_NONBLOCK; +int y = (int)SYS_getrandom; ]])], [have_getrandom_interface=yes AC_DEFINE([HAVE_GETRANDOM_INTERFACE], [1], [Define to 1 if getrandom linux syscall interface is available.])],
参考:https://lists.kernelnewbies.org/pipermail/kernelnewbies/2016-June/016461
参考:https://bugs.ruby-lang.org/issues/11395
参考:https://sourceforge.net/p/ltp/mailman/message/34238553/
参考:http://stackoverflow.com/questions/36744009/checking-for-getrandom-function-returns-no-when-building-python-3-5-1-on-ubunt
参考:https://github.com/http2/http2-spec/wiki/ALPN-Status
参考:http://homeunix.nl/newsportal/article.php?id=1446222&group=linux.debian.bugs.dist#1446222
参考:https://github.com/rbenv/ruby-build/issues/914
参考:http://stackoverflow.com/questions/36744009/checking-for-getrandom-function-returns-no-when-building-python-3-5-1-on-ubunt
The build fails because it cannot find the getrandom syscall. The getrandom call was introduced in version 3.17 of the Linux kernel (according to its man page).
那么是Linux内核导致的问题?
但是经过测试:
1. Linux 3.10.0-327.28.2.el7.x86_64 不行
2. Linux 3.18.40 不行
3. Linux 4.7.0-1.el7.elrepo.x86_64 不行
那么原因应该不仅仅是Linux内核版本的问题。
参考:
怎么解决?
最后是通过gnutls官方提供的git途径编译安装gnutls成功。中途没有出现SYS_getrandom未声明这样的报错。
经过测试:
1. Linux 3.10.0-327.28.2.el7.x86_64 尚未测试
2. Linux 3.18.40 编译安装成功
3. Linux 4.7.0-1.el7.elrepo.x86_64 编译安装成功