Minor bug during 'make check' under MSys/MinGW

Alan McFarlane alan.mcfarlane at gmail.com
Sat May 7 14:01:48 CEST 2005

Hi folks...

I think i've uncovered a minor bug in the gmp-4.1.4 distribution - an 
undefined reference to 'random'.

Whilst attempting a complete installation from scratch, I performed the 
following operations:

./configure --prefix=/usr/local --enable-mpfr
-- completed successfully

-- completed successfully

make check
-- failed (see dump at the end of this email)
-- the pertinant lines are:

tabs.o(.text+0x2a): In function `drand':
undefined reference to `random'

Now, examining mpfr-test.h:118 I found the following expression:
   i[0] = LONG_RAND();

Now, performing a quick search, I found that LONG_RAND is #defined as
   #define LONG_RAND random

However 'random' is neither declared as a function or a #definition 
before this. I can only assume that it should be #defined as
   #define LONG_RAND rand

which would use the stdlib.h rand() function.

As I suspect the compilation succeeds on other platforms, I can only 
suspect that my platform is causing the problem: For ease of bug 
reporting, there is a tool called 'msysinfo' which dumps information 
about my environment:

$ msysinfo
msysinfo-1.3: Send this to the MSYS support list:

MSYS 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown; targ=MINGW32
GNU bash, version 2.04.0(1)-release (i686-pc-msys); ENV=.profile
GNU Make version 3.79.1,Built for i686-pc-msys; MAKE_MODE=unix
gcc.exe (GCC) 3.2.3 (mingw special 20030504-1); targ=MINGW32
GNU ld version 2.13.90 20030111
    789320 Tue Mar 16 13:32:49 2004 /bin/msys-1.0.dll
    135680 Tue Mar 16 13:32:48 2004 /bin/make.exe
     82432 Mon May 05 00:38:20 2003 /mingw/bin/gcc.exe
    566272 Sun Jan 12 05:42:48 2003 /mingw/bin/ld.exe
Sysname=MINGW32_NT-5.1  OSTYPE=msys  TERM=msys

As the error is not important (just niggling) I've ignored it and 
continued installation with 'make install' and have been happily using 
gmp without any other apparent problems.

However, I'd be grateful if someone could check, or even confirm, this 
error for me.

Alan McFarlane

------------------------------------- make check (partial listing) --

make[2]: Entering directory `/usr/local/src/gmp-4.1.4/mpfr/tests'
make  reuse.exe tabs.exe tadd.exe tagm.exe tcan_round.exe tcmp.exe 
tcmp2.exe tcmp_ui.exe tdiv.exe tdiv_ui.exe tdump.exe teq.exe texp.exe 
tget_str.exe tlog.exe tconst_log2.exe tmul.exe tmul_2exp.exe tmul_ui.exe 
tout_str.exe tconst_pi.exe tpow.exe trandom.exe tround_prec.exe 
tset_d.exe tset_f.exe tset_q.exe tset_si.exe tset_str.exe tset_z.exe 
tsqrt.exe tsqrt_ui.exe tui_div.exe tui_sub.exe tswap.exe ttrunc.exe 
trint.exe tisnan.exe tget_d.exe tatan.exe tcosh.exe tsinh.exe ttanh.exe 
tacosh.exe tasinh.exe tatanh.exe thyperbolic.exe texp2.exe 
tfactorial.exe tsub.exe tasin.exe tconst_euler.exe tcos.exe tsin.exe 
ttan.exe tsub_ui.exe tset.exe tlog1p.exe texpm1.exe tlog2.exe tlog10.exe 
tui_pow.exe tpow3.exe tadd_ui.exe texceptions.exe tfma.exe thypot.exe 
make[3]: Entering directory `/usr/local/src/gmp-4.1.4/mpfr/tests'
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../mpfr    -g -O2 
-fomit-frame-pointer -mcpu=athlon -march=athlon -ffloat-store -c `test 
-f reuse.c || echo './'`reuse.c
/bin/sh ../../libtool --mode=link gcc  -g -O2 -fomit-frame-pointer 
-mcpu=athlon -march=athlon -ffloat-store   -o reuse.exe  reuse.o 
../libmpfr.a ../../libgmp.la -lm
mkdir .libs
gcc -g -O2 -fomit-frame-pointer -mcpu=athlon -march=athlon -ffloat-store 
-o reuse.exe reuse.o  ../libmpfr.a ../../.libs/libgmp.a -lm
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../mpfr    -g -O2 
-fomit-frame-pointer -mcpu=athlon -march=athlon -ffloat-store -c `test 
-f tabs.c || echo './'`tabs.c
/bin/sh ../../libtool --mode=link gcc  -g -O2 -fomit-frame-pointer 
-mcpu=athlon -march=athlon -ffloat-store   -o tabs.exe  tabs.o 
../libmpfr.a ../../libgmp.la -lm
gcc -g -O2 -fomit-frame-pointer -mcpu=athlon -march=athlon -ffloat-store 
-o tabs.exe tabs.o  ../libmpfr.a ../../.libs/libgmp.a -lm
tabs.o(.text+0x2a): In function `drand':
undefined reference to `random'
undefined reference to `random'
undefined reference to `random'
undefined reference to `random'
tabs.o(.text+0x2c0): In function `check_inexact':
C:/MSys/local/src/gmp-4.1.4/mpfr/tests/tabs.c:48: undefined reference to 
more undefined references to `random' follow
make[3]: *** [tabs.exe] Error 1
make[3]: Leaving directory `/usr/local/src/gmp-4.1.4/mpfr/tests'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/usr/local/src/gmp-4.1.4/mpfr/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/gmp-4.1.4/mpfr'
make: *** [check-recursive] Error 1

More information about the gmp-discuss mailing list