GMP build issues

Duke Hound dukethek9 at gmail.com
Sat Jun 21 22:16:01 CEST 2008


Duke Hound wrote:
> Sisyphus wrote:
>>
>> ----- Original Message ----- From: "Duke Hound" <dukethek9 at gmail.com>
>> To: <gmp-discuss at swox.com>
>> Sent: Saturday, June 21, 2008 11:32 AM
>> Subject: GMP build issues
>>
>>
>>> [Sorry if this is the second time this message got sent to the group (i
>>> sent the first one before subscribing - doh!)]
>>>
>>> Hello,
>>>
>>> I am trying to build the gmp-4.2.2 library; however, I am receiving
>>> errors during the 'make check' step.  I am using a windows XP SP2
>>> machine with MinGW (gcc version 3.4.5 (mingw-vista special)) that came
>>> as part of the IDE CodeBlocks.
>>>
>>
>> It might simply be that you need to run 'make' before running 'make 
>> check'.
>>
>> On Windows, if I run 'make check' straight after configure (without 
>> first running 'make') I, too, get an error - though in my case the 
>> error I'm getting is that libgmp.la cannot be found. (This error is 
>> to be expected since libgmp.la, which gets built during the 'make' 
>> step, has not yet been created.)
>>
>> By running './configure' (without any additional arguments), you'll 
>> be building a dynamic (dll) gmp library and, for me, 'make check' is 
>> failing all tests with such builds. I don't know why that happens. 
>> Afaict, there's nothing wrong with the dll that gets built - the apps 
>> that I build using that dll always work as they should.
>>
>> I'd be interested to know if 'make check' succeeds for you (after 
>> you've run 'make').
>>
>> The problem applies only to dynamic builds. If I build a static gmp 
>> library (by starting with './configure --disable-shared 
>> --enable-static') there's no problem with 'make check'.
>>
>> Cheers,
>> Rob
>
> 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?
> 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
>
> make check seemed to pass.
>
> ======PART 2 Linking Libary Issues===========
>
> 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;
> }
>
> Here is the output from the build log
> -------------- Build: Debug in stringmath ---------------
>
> mingw32-g++.exe  -o bin\Debug\stringmath.exe obj\Debug\main.o 
> obj\Debug\files\sint.o    
> E:\mysql++-3.0.3\include_lib_a_def\libmysqlclient.a 
> E:\mysql++-3.0.3\include_lib_a_def\libmysqlpp.a 
> E:\C++\codeblocks\libraries\libmapm.a 
> E:\C++\codeblocks\libraries\gmp\msys\libgmp.a 
> E:\C++\codeblocks\libraries\gmp\msys\libgmpxx.a 
> E:\C++\codeblocks\libraries\gmp\msys\libcxx.a
> E:\C++\codeblocks\libraries\gmp\msys\libgmpxx.a(osmpz.o):osmpz.cc:(.text+0x39): 
> undefined reference to `___gmpz_get_str'
> E:\C++\codeblocks\libraries\gmp\msys\libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x9d): 
> undefined reference to `___gmp_doprnt_integer'
> E:\C++\codeblocks\libraries\gmp\msys\libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0xa9): 
> undefined reference to `___gmp_asprintf_final'
> E:\C++\codeblocks\libraries\gmp\msys\libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x4): 
> undefined reference to `___gmp_asprintf_memory'
> E:\C++\codeblocks\libraries\gmp\msys\libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x8): 
> undefined reference to `___gmp_asprintf_reps'
>
> I do not receive the undefined reference errors when I comment out the 
> cout line.
>
> After doing some reading online, I think (I could be absolutely off 
> the mark though) these link errors have to do with the make procedure 
> using the cygwin c++ runtime libraries instead of mingw32 c++ runtime 
> libraries.  (I do not have cygwin installed, just the msys).  I think 
> this has to do with the -mno-cygwin switch during the make process above.
>
> The output from the configure/make/make check commands are attached.
>
> How do I resolve these undefined reference errors.  Thanks.
>
> Thanks for walking/talking through this with me.
>
Hello,
-I think the dll was not created becase the libtool had undefined 
symbols, so it just made the static lib.
-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?

Attempts:
$ ./configure --disable-shared --enable-static --enable-cxx > 
/home/dan/config.log
$ make > /home/dan/make.log
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

$ ./configure CFLAGS="cl /MD" --disable-shared --enable-static 
--enable-cxx > /
home/dan/config_flags.log
configure: error: could not find a working compiler, see config.log for 
details

$ ./configure CFLAGS=cl/MD --disable-shared --enable-static --enable-cxx 
 > /hom
e/dan/config_flags.log
configure: error: could not find a working compiler, see config.log for 
details

$ ./configure CFLAGS='cl /MD' --disable-shared --enable-static 
--enable-cxx > /
home/dan/config_flags.log
configure: error: could not find a working compiler, see config.log for 
details

$ ./configure CFLAGS=cl /MD --disable-shared --enable-static 
--enable-cxx > /ho
me/dan/config_flags.log
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: /MD
Invalid configuration `/MD': machine `/MD' not recognized
configure: error: /bin/sh ./config.sub /MD failed

Thanks,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20080621/11b28b5f/attachment.html 


More information about the gmp-discuss mailing list