jirka-h / haveged

Entropy daemon ![Continuous Integration](https://github.com/jirka-h/haveged/workflows/Continuous%20Integration/badge.svg)
GNU General Public License v3.0
271 stars 34 forks source link

Can't build in cygwin #72

Closed jbaker6953 closed 1 year ago

jbaker6953 commented 2 years ago

$ ./configure runs ok, but make barfs.

$ make
make  all-recursive
make[1]: Entering directory '/haveged-1.9.18'
Making all in src
make[2]: Entering directory '/haveged-1.9.18/src'
gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wpedantic -I.. -g -O2 -c -o haveged.o haveged.c
haveged.c:42:10: fatal error: linux/random.h: No such file or directory
   42 | #include <linux/random.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:524: haveged.o] Error 1
make[2]: Leaving directory '/haveged-1.9.18/src'
make[1]: *** [Makefile:476: all-recursive] Error 1
make[1]: Leaving directory '/haveged-1.9.18'
make: *** [Makefile:372: all] Error 2
jirka-h commented 2 years ago

Hi,

thanks for the report!

./configure is checking for "linux/random.h". Please look for HAVE_LINUX_RANDOM_H in config.h generated by ./configure

config.h-/* Define to 1 if you have the <linux/random.h> header file. */
config.h:#define HAVE_LINUX_RANDOM_H 1

I have checked where in code is HAVE_LINUX_RANDOM_H used and to my surprise, there were no matches. I have checked historical version 1.9.2, too (this is when I took over the maintenance of the haveged project).

/usr/include/linux/random.h is crucial as it holds the definition of RNDADDTOENTCNT to add entropy to the kernel. On my Fedora, this file is part of kernel-headers-5.18.4-100.fc35.x86_64 package.

$ls /proc/sys/kernel/random/
boot_id  entropy_avail  poolsize  urandom_min_reseed_secs  uuid  write_wakeup_threshold

I think this file should be part of CYGWIN - if you have /dev/random, you should have linux/random.h as well.

I have also checked the code changes and the #include <linux/random.h> dependency hasn't been modified at least from 2018. Since compilation on CYGWIN was working in the past, I suspect something has changed on CYGWIN side.

I would like to ask for your help. Could you please ask at the CYGWIN mailing list about the support for <linux/random.h>? It seems it was there in the past.

Thanks a lot Jirka

jirka-h commented 2 years ago

One more question - apparently, CYGWIN comes with the rng-tools package:

https://cygwin.com/packages/summary/rng-tools-src.html

This package also depends on linux/random.h Could you please check if rng-tools package is available and working on your installation? If so, it seems like some *-devel package is missing to allow the compilation of haveged.