当我尝试安装Math::TrulyRandom(随机数生成器与伪随机数)时,我听了这个人的建议,我正在运行'dmake',他告诉我在另一个问题上询问错误。
我的第一个问题是here。
这是终端出了什么问题:
C:\Users\Jlinne\Documents> cpanm --prompt Math::TrulyRandom
--> Working on Math::TrulyRandom
Fetching http://www.cpan.org/authors/id/G/GA/GARY/Math-TrulyRandom-1.0.tar.gz ... OK
Configuring Math-TrulyRandom-1.0 ... OK
Building and testing Math-TrulyRandom-1.0 ... Building Math-TrulyRandom-1.0 failed.
You can s)kip, r)etry, e)xamine build log, or l)ook ? [s] l
Entering C:/Users/Jlinne/.cpanm/work/1476593741.7660/Math-TrulyRandom-1.0 with C:\WINDOWS\system32\cmd.exe
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\Jlinne\.cpanm\work\1476593741.7660\Math-TrulyRandom-1.0>perl Makefile.PL
Generating a dmake-style Makefile
Writing Makefile for Math::TrulyRandom
Writing MYMETA.yml and MYMETA.json
C:\Users\Jlinne\.cpanm\work\1476593741.7660\Math-TrulyRandom-1.0>dmake
Skip blib\lib\Math\TrulyRandom.pm (unchanged)
Skip blib\lib\Math\TrulyRandom.pod (unchanged)
Running Mkbootstrap for Math::TrulyRandom ()
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "TrulyRandom.bs"
gcc -c -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.0\" -DXS_VERSION=\"1.0\" "-IC:\STRAWB~1\perl\lib\CORE" TrulyRandom.c
gcc -c -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.0\" -DXS_VERSION=\"1.0\" "-IC:\STRAWB~1\perl\lib\CORE" truerand.c
truerand.c: In function 'tick':
truerand.c:57:19: error: storage size of 'it' isn't known
struct itimerval it, oit;
^
truerand.c:57:23: error: storage size of 'oit' isn't known
struct itimerval it, oit;
^
truerand.c:62:16: error: 'ITIMER_REAL' undeclared (first use in this function)
if (setitimer(ITIMER_REAL, &it, &oit) < 0)
^
truerand.c:62:16: note: each undeclared identifier is reported only once for each function it appears in
truerand.c: In function 'interrupt':
truerand.c:71:16: error: 'SIGALRM' undeclared (first use in this function)
(void) signal(SIGALRM, interrupt);
^
truerand.c: In function 'roulette':
truerand.c:86:16: error: 'SIGALRM' undeclared (first use in this function)
(void) signal(SIGALRM, interrupt);
^
dmake: Error code 129, while making 'truerand.o'
C:\Users\Jlinne\.cpanm\work\1476593741.7660\Math-TrulyRandom-1.0>
答案 0 :(得分:2)
Math :: TrulyRandom已损坏,不应使用(实际上不能)。
它是在1996年编写的,只能在当时存在的某些UNIX系统上正常工作(如SunOS 4)。它无法在现代Linux系统上生成随机数据,也无法在Windows上进行编译。
如果您需要一个随机数生成器并且rand
不会删除它,请查找另一个模块。例如Math::Random::Secure或Crypt::Random。