mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > GMP-ECM

Reply
 
Thread Tools
Old 2007-04-03, 12:47   #1
tmorrow
 
tmorrow's Avatar
 
Jan 2004

10310 Posts
Default Compiling GMP-ECM With GWNUM

Apologies for the lengthy compile fragments below. I'm having trouble compiling ECM with GWNUM, described in the INSTALL notes for ECM as being Woltman's high performance library for factoring Fermat numbers. Here's the sources I used:

gmp-4.2.1 (http://gmplib.org/)
ecm-6.1.2 (http://gforge.inria.fr/frs/?group_id=135&release_id=830)
gwnum (ftp://mersenne.org/gimps/source2414.zip)

I've tried building on both Windows (cygwin environment) and on Linux (LFS distribution).

I'm able to get ECM working fine without GWNUM under both OS's. However when I try to use GWNUM I run into a plethora of problems on each platform. I suspect the problem is due to not knowing how properly compile GWNUM and not knowing which GWNUM distribution to use, there are 4 to choose from:

ftp://mersenne.org/gimps/gwnum_gpl.zip
ftp://mersenne.org/gimps/gwnum_gpl_linux.tgz
ftp://mersenne.org/gimps/gwnum_gpl_mingw.tgz
ftp://mersenne.org/gimps/source2414.zip

I've tried various permutations on each platform with no success. Use of the supplied gwnum.lib distributed in the 4 above packs wreaks havoc too.

Windows (cygwin)

Attempting to compile using "nmake /f compile" (invoking VC++ 6 in my case) produces the following error:

C:\tim\mingprojects\source2414\gwnum>nmake /f compile

Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

cl /GF /W3 /MT /D_CRT_SECURE_NO_DEPRECATE /O /c /I..\qd /Forelease\gwdbldbl.obj gwdbldbl.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

gwdbldbl.cpp
..\qd\dd.cc(26) : error C2871: 'std' : does not exist or is not a namespace
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.


A Google hit (http://www.cs.colorado.edu/~main/vccode.html) indicates this as a problem in VC++6 that can be fixed by "removing the directive for using namespace std". I don't know how to do this.

Trying to run the make in a cygwin window produces:

C:\tim\mingprojects\source2414\gwnum>make
gcc -I.. -O2 -march=i486 -malign-double -DADD_UNDERSCORES -c cpuid.c
gcc -I.. -O2 -march=i486 -malign-double -DADD_UNDERSCORES -c gwnum.c
gcc -I.. -O2 -march=i486 -malign-double -DADD_UNDERSCORES -c gwutil.c
g++ -I.. -I../qd -O2 -march=i486 -malign-double -DADD_UNDERSCORES -c gwdbldbl.cpp
gcc -I.. -O2 -march=i486 -malign-double -DADD_UNDERSCORES -c giants.c
gcc -I.. -O2 -march=i486 -malign-double -DADD_UNDERSCORES -c ecmstag1.c
objcopy -Oelf32-i386 -Icoff-i386 mult.obj mult.o
c:\mingw\bin\objcopy.exe: mult.obj: Invalid bfd target
make: *** [mult.o] Error 1


Trying to use the supplied gwnum.lib library fails during the ECM make, here's the compile fragment:

gcc -g -O2 -IC:/tim/mingprojects/gwnum -o ecm.exe -Wl,gwdata.ld ecm-auxi.o ecm-b1_ainc.o ecm-candi.o ecm-eval.o ecm-random.o ecm-main.o ecm-trial.o ecm-resume.o ecm-getprime.o libecm.a -lm C:/tim/mingprojects/gwnum/gwnum.lib C:/tim/mingprojects/gmp/lib/libgmp.a
C:/tim/mingprojects/gwnum/gwnum.lib(gwdbldbl.o):gwdbldbl.cpp:(.text+0x94f0): multiple definition of `___gxx_personality_v0'
libecm.a(Fgw.o):/cygdrive/c/tim/mingprojects/ecm-6.1.2/Fgw.c:62: first defined here
libecm.a(Fgw.o): In function `Fdwordstogw_simple':
/cygdrive/c/tim/mingprojects/ecm-6.1.2/Fgw.c:256: undefined reference to `__FFTLEN'


Linux (LFS)

Compiling GWNUM via make produces the same error as with the windows attempt.

Attempting to use the supplied gwnum.lib distributed with gwnum_gpl_linux.tgz in the ECM compile actually works (better than in windows) but then one of the "make check" tests fails. I'm assuming the problem here is mixing code from different compilers.

Has anyone managed to get GWNUM to compile, link and run with ECM? If so, can you provide details how you got it to work. Alternatively if you have any suggestions on how I might get past the above problems, I'm all ears.

Thanks,
Tim
tmorrow is offline   Reply With Quote
Old 2007-04-03, 13:17   #2
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

46438 Posts
Default

Yes, there appears to be a bug. Compiling under Linux worked pretty smooth here, but 2^n+1 numbers produce wrong residues. However, 2^n-1 numbers seem to work... probably something to do with converting numbers between GMP and GWNUM representation.

Another thing that goes on my GMP-ECM to-do list. Unfortunately I can't make a promise as to when I'll fix this. It'll happen this summer, but I can't be more specific that this. For now, I'm afraid I have to advise against using GWNUM compiled into GMP-ECM. Instead, produce stage 1 residues with Prime95 or mprime, using the GmpEcmHook=1 option in prime.ini, then -resume them with GMP-ECM.

Alex
akruppa is offline   Reply With Quote
Old 2007-04-03, 13:25   #3
tmorrow
 
tmorrow's Avatar
 
Jan 2004

1478 Posts
Default

Thanks for the prompt reply Alex. I'm sorry to hear there is a bug, I hope it can be resolved without too much trouble.

I'm not sure why the windows compiles are causing so many problems for me though.

In the meantime I will stick to your suggestion of using prime95 for stage 1 and then resume with GMP-ECM (no GNUM).

Cheers,
Tim
tmorrow is offline   Reply With Quote
Old 2007-04-03, 14:07   #4
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

2,467 Posts
Default

There are a few hacks in both GWNUM and GMP-ECM to account for the different name mangling schemes of Windows and *nix C compilers, i.e. where underscores get added and where not. It seems that the global FFTLEN variable doesn't have underscores added any more, I need to account for that change in GMP-ECM.

Building the GWNUM library from sources requires a binutils installation that can process COFF-32 files. The default packages can't, you need to recompile them (takes awfully long!)

I have never tried to compile GMP-ECM with GWNUM in Visual C, in fact, I never used Visual C at all. I think it will be hard to compile GMP-ECM with GWNUM there and I can't really help with problems, having no way to reproduce them.

Alex
akruppa is offline   Reply With Quote
Old 2007-04-03, 21:21   #5
tmorrow
 
tmorrow's Avatar
 
Jan 2004

103 Posts
Default

Hmm! I do have the binutils tool installed in my Cygwin. I'll explore whether it's being picked up and used properly.

Compiling from sources may be an option. I appreciate it may take a while but why not put the PC to work! Is there a make file for compiling everything in GWNUM from scratch that I can use?

I was only using VC6++ because the readme.txt for GWNUM suggested on windows to compile using "nmake /f compile", so I gave it a try. On my system that automatically invoked Microsoft's utility/compiler. I'll put that on the back burner!

Thanks,
Tim
tmorrow is offline   Reply With Quote
Old 2007-04-04, 00:39   #6
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

11110000011002 Posts
Default

The assembly code must be compiled using MASM from the Visual C++ product. The download should include the .obj files produced by MASM so you should be able to skip this step unless you are planning on changing the assembly code.

The MASM object files are converted to ELF format by objcopy in binutils. Again the download should include the converted object files, so you should be able to skip this step too.

The C and C++ code associated with the gwnum library must be compiled using the same compiler you are using to compile gmp-ecm.
Prime95 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem compiling GMP-ECM with gwnum... WraithX GMP-ECM 9 2011-08-21 22:45
LLR V3.8.2 using gwnum 26.2 is available! Jean Penné Software 25 2010-11-01 15:18
GWNUM? Unregistered Information & Answers 3 2010-09-12 19:52
GWNUM as DLL? Cyclamen Persicum Software 1 2007-01-02 20:53
compiling gwnum ATH GMP-ECM 8 2006-07-17 18:02

All times are UTC. The time now is 08:27.


Thu Dec 9 08:27:37 UTC 2021 up 139 days, 2:56, 0 users, load averages: 1.32, 1.36, 1.51

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.