Problem setting environment for GMP in msys on Windows

muggins senior muggins_senior at
Tue Sep 7 01:58:45 CEST 2010

Dear GMP person,

This is not really a bug report, more an admission of defeat.  I am hoping to write programs using GMP on the msys Linux-type environment in Windows, but my Linux knowledge is too low to get started.

I have completed some steps:
- unzipped the package
- ran "configure"
- saw an error message, Googled until I found "unset $CFLAGS", and ran "configure" again
- ran "make" -- all looks OK
- ran "make check" -- all looks OK
- ran "make install" -- all looks OK, but I don't understand the helpful message about libtool and -LLIBDIR.

Now, if I "cd demos" and "make pexpr", I get a lot of compile errors, starting with:
   pexpr.c:59:17: gmp.h: No such file or directory
then a lot of stuff about implicit declarations etc. -- so it hasn't seen the files it's meant to link with?  If I copy gmp.h from the directory above "demos", then the compile errors change to many lines like:
   C:/DOCUME~1/ME3FF5~1.WYN/LOCALS~1/Temp/ccWHUo82.o:pexpr.c:(.text+0x2eb): undefined reference to `__gmpz_init'

My guess is that something is wrong with the environment or the makefile.  This is almost certainly not a GMP bug, and I'm willing to learn as much as I need to about Linux maintenance.  However, I'm not interested in that for its own sake (not even for my long-term betterment) and I'm not sure where to start: libtools, make, configure, set, setenv, gcc -L, ...???  Any help would be greatly appreciated!

Many thanks,
Sheffield, UK

Here are some indications of the setup:
$gcc -v
Reading specs from c:/mingw/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)

$ uname -a
MINGW32_NT-5.1 WYNN07771714323 1.0.11(0.46/3/2) 2007-01-12 12:05 i686 Msys

$ ./config.guess

$ ./configfsf.guess

Some executable were successfully made during the "make" etc. -- in the installing directory and its /tests/ sub-directory, etc.

The directory where I unzipped the files and ran "configure", etc is c:\msys\1.0\home\gmp\gmp-4.3.2 (or, to msys, ~/gmp/gmp-4.3.2).  I now have three copies of -- one there, one in its subdirectory .libs, and one in C:\msys\1.0\local\lib (to msys, this is /usr/local/lib).  This is not on the PATH but it is in LDFLAGS:

$ echo $PATH
.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/GnuWin32/bin:/mingw/bin/:/:/c/Program Files/PC Connectivity Solution/:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Program Files/ATI Technologies/ATI Control Panel:/c/Program Files/QuickTime/QTSystem/:.

$ echo $LDFLAGS

$ echo $CFLAGS 
-pipe -O2 -mms-bitfields -march=i686

$ echo $CPPFLAGS

(Things don't seem to change if I put that -I into $CFLAGS as well.)

$ make pexpr 
gcc -std=gnu99 -m32 -O2 -pedantic -fomit-frame-pointer -mtune=k8 -march=k8 -mno-cygwin    pexpr.c   -o pexpr
pexpr.c:59:17: gmp.h: No such file or directory
pexpr.c:77: error: syntax error before "__mpz_struct"
pexpr.c:77: warning: type defaults to `int' in declaration of `__mpz_struct'

(With copy of gmp.h in directory:)
$ gcc -std=gnu99 -m32 -O2 -pedantic -fomit-frame-pointer -mtune=k8 -march=k8 -m
no-cygwin  -L/usr/local/lib/ -L/usr/local/lib/libgmp.a   pexpr.c   -o 
C:/DOCUME~1/ME3FF5~1.WYN/LOCALS~1/Temp/ccujrTWJ.o:pexpr.c:(.text+0x2eb): undefined reference to `__gmpz_init'
C:/DOCUME~1/ME3FF5~1.WYN/LOCALS~1/Temp/ccujrTWJ.o:pexpr.c:(.text+0x36a): undefined reference to `__gmpz_set_str'


More information about the gmp-bugs mailing list