GMP build issues

Sisyphus sisyphus1 at optusnet.com.au
Sun Jun 22 02:19:20 CEST 2008


----- Original Message ----- 
From: "Duke Hound" <dukethek9 at gmail.com>
.
.
>> Hello,
>> I decided to reinstall msys and start again.
>> Details:
>> -Windows XP SP2
>> -I have MinGW (gcc version 3.4.5 (mingw-vista special)) at
>> C:\Program Files\CodeBlocks\MinGW\
>> -I have MSYS 1.0.10 at
>> C:\msys\1.0\
>> -In C:\msys\1.0\etc\fstab i have the following mount setting:
>> "c:/progra~1/codeblocks/mingw /mingw"
>> -I have unzipped GMP 4.2.2 to
>> C:\msys\1.0\home\dan\gmp-4.2.2
>>
>> ======PART 1 BUILD ===========
>> [note: the msys make is 3.79.1 built for i686-pc-msys , whereas the
>> mingw32-make is GNU Make 3.81 built for i386-pc-mingw32]
>>
>> my commands (with the new setup as described above) (output of these
>> commands are attached in the .zip)
>> ./configure --enable-cxx
>> make
>> make check
>>
>> When I build this I do not get any DLL files, even though I do not
>> provide the '--disable-shared --enable-static' switches.  Please explain?

My mistake. I thought dynamic libs were the default, but when I look at the 
./configure output you provided with your original post I see:

checking whether to build shared libraries... no
checking whether to build static libraries... yes

That's why you get only static libraries.
I expect that, for dynamic libs, you'll need to run:

./configure --disable-static --enable-shared --enable-cxx

That should produce a correctly functioning dll - though, as I mentioned 
earlier, 'make check' doesn't work for me when I build dynamic libs. (I 
prefer static libs anyway.)

>> During the make I receive the following warnings which i think are
>> related to PART 2 of this email.
>>
>> libtool: link: warning: undefined symbols not allowed in
>> athlon-pc-mingw32 shared libraries
>> libtool: link: warning: undefined symbols not allowed in
>> athlon-pc-mingw32 shared libraries

They're just warnings, and can be ignored.

>>
>> make check seemed to pass.

If you run 'make install' then gmp.h should be installed into 
C:/msys/1.0/local/include, and the libs should be installed into 
C:/msys/1.0/local/lib. You access them from the command line using the '-I', 
'-L', and '-l' switches.

>> Now, I am trying to use the library that i just built.
>>
>> Here is the simple code
>> #include <gmpxx.h>
>> using namespace std;
>> int main() {
>> mpz_class a;
>> a = 1234;
>> cout << a << endl;
>> return 0;
>> }
>>

Assuming that file is called 'test.cpp', and that you've run 'make install', 
you would build that (in the msys shell) by running:

g++ -o mytest.exe test.cpp -I/usr/local/include -L/usr/local/lib -lgmpxx

If you're in the cmd.exe shell, then /usr/local/include and /usr/local/lib 
won't be understood so it becomes:

g++ -o mytest.exe 
test.cpp -IC:/msys/1.0/local/include -LC:/msys/1.0/local/lib -lgmpxx

(Just replace 'mytest.exe' and 'test.cpp' with whatever is appropriate.)]

.
.
> -I saw the following from the GMP documentation
> "MINGW uses the C runtime library `msvcrt.dll' for I/O, so applications
> wanting to use the GMP I/O routines must be compiled with `cl /MD' to do
> the same. If one of the other C runtime library choices provided by MS C
> is desired then the suggestion is to use the GMP string functions and
> confine I/O to the application. "
> Could this be the reason for the undefined references?  If so how do I
> "complie with the `cl /MD`"?  Do I have to use ./configure CFLAGS=cl /MD?

'cl' is the microsoft compiler. That advice is for those who want to build 
their apps using Visual Studio as the compiler. It doesn't apply to you as 
you are using the MinGW compiler.

Cheers,
Rob 



More information about the gmp-discuss mailing list