Diehard随机测试套件无法编译

Dieharder random test suite does not compile

本文关键字:编译 套件 随机测试 Diehard      更新时间:2023-10-16

我正在尝试使用diehard来测试随机序列的质量。为了在Windows上编译它,我已经安装了msys和gsl开发。GSL编译没有任何问题。为了编译Dieharder,我首先运行./configure然后当我在 msys 中输入 make 时,它会返回以下错误消息:

(cd libdieharder; make)
make[1]: Entering directory `/f/dieharder-3.31.1/libdieharder'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -DVERSION=3.31.1 -DLITTLE_ENDIAN=1 -I ../include -I /usr/local/include  -std=c99 -Wall -pedantic -g -O2 -MT libdieharder_la-dab_dct.lo -MD -MP -MF .deps/libdieharder_la-dab_dct.Tpo -c -o libdieharder_la-dab_dct.lo `test -f 'dab_dct.c' || echo './'`dab_dct.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DVERSION=3.31.1 -DLITTLE_ENDIAN=1 -I ../include -I /usr/local/include -std=c99 -Wall -pedantic -g -O2 -MT libdieharder_la-dab_dct.lo -MD -MP -MF .deps/libdieharder_la-dab_dct.Tpo -c dab_dct.c  -DDLL_EXPORT -DPIC -o .libs/libdieharder_la-dab_dct.o
make[1]: Leaving directory `/f/dieharder-3.31.1/libdieharder'

错误消息是:

dab_dct.c: In function 'fDCT2':
dab_dct.c:251:44: error: 'M_PI' undeclared (first use in this function)
      output[i] += (double) input[j] * cos((M_PI / len) * (0.5 + j) * i);
                                            ^~~~
dab_dct.c:251:44: note: each undeclared identifier is reported only once for each function it appears in
dab_dct.c: In function 'iDCT2':
dab_dct.c:274:30: error: 'M_PI' undeclared (first use in this function)
      sum += input[j] * cos(((M_PI * j) / len) * (0.5 + i));
                              ^~~~
dab_dct.c: In function 'evalMostExtreme':
dab_dct.c:289:15: warning: variable 'pos' set but not used [-Wunused-but-set-variable]
  unsigned int pos = 0;
               ^~~
make[1]: *** [libdieharder_la-dab_dct.lo] Error 1
make[1]: Leaving directory `/f/dieharder-3.31.1/libdieharder'
make: *** [libwulf.time] Error 2

我的问题是我是否应该在文件开头声明M_PI,还是在安装过程中犯了错误?

量在math.h中,你可以在那里找到M_PI。