![]() |
|
|
#1 |
|
P90 years forever!
Aug 2002
Yeehaw, FL
2×53×71 Posts |
I'm looking at using GMP in prime95 v29.3. I can build the library under linux and Mac OS X (and I assume FreeBSD).
I've tried to create Windows 32-bit and 64-bit DLLs without success. I tried using Mingw-w64 and Msys2 as well as Cygwin. One OS was 32-bit Windows Vista, another was 64-bit Windows 10. Who here can help me get these DLLs built? I need to learn how to do it myself so that I can build the DLLs as new GMP versions become available. |
|
|
|
|
|
#2 |
|
Sep 2003
50318 Posts |
Perhaps you could try MPIR on Windows rather than GMP? It's a fork of GMP, which might be easier than GMP to compile and use on Windows.
It should work exactly the same way, in particular they both have a function: int mpz_jacobi (mpz_t a, mpz_t b) Last fiddled with by GP2 on 2017-08-28 at 17:52 |
|
|
|
|
|
#3 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
|
|
|
|
|
|
#4 | |
|
Einyen
Dec 2003
Denmark
1100010101112 Posts |
I was about to write a guide on how I normally compile it in MSYS2, but I never compile a shared version only a static version. So I tested it just now and I can compile a shared version but it fails "make check".
I found this info: https://gmplib.org/manual/Known-Build-Problems.html Quote:
|
|
|
|
|
|
|
#5 |
|
Einyen
Dec 2003
Denmark
35·13 Posts |
I managed to compile MPIR 3.0.0 shared version, so here is a guide for that:
Download the msys2-x86_64 package and install to the default c:\msys64: http://www.msys2.org/ Run: pacman -Syu (forcefully close MSYS2 when it informs you) Edit the file: C:\msys64\etc\profile : Change the line: MSYS2_PATH="/usr/local/bin:/usr/bin:/bin" to MSYS2_PATH="/usr/local/bin:/usr/bin:/bin:/mingw64/bin" (start MSYS2) pacman -Su (restart MSYS2) install needed packages: pacman -S mingw-w64-x86_64-gcc pacman -S mingw-w64-x86_64-make pacman -S mingw-w64-x86_64-libtool pacman -S autoconf pacman -S automake pacman -S mingw-w64-x86_64-python3 pacman -S mingw-w64-x86_64-yasm (only needed for MPIR, not for GMP 6.1.2) Rename "C:\msys64\mingw64\bin\mingw32-make.exe" to "make.exe" in the same folder, or make a copy first and then rename. MSYS2 has a preinstalled GMP version which does not seem easy to remove because other packages are dependent on it, so if it interferes you can move the files to another folder. This probably only happens if you need to compile other programs in MSYS2, that needs to use your own compiled GMP/MPIR version. The pre-installed GMP files are: C:\msys64\mingw64\bin\libgmp-10.dll C:\msys64\mingw64\bin\libgmpxx-4.dll C:\msys64\mingw64\lib\libgmp.a C:\msys64\mingw64\lib\libgmp.dll.a C:\msys64\mingw64\lib\libgmpxx.a C:\msys64\mingw64\lib\libgmpxx.dll.a C:\msys64\mingw64\include\gmp.h C:\msys64\mingw64\include\gmpxx.h Download MPIR 3.0.0 http://mpir.org/downloads.html and compile: ./configure ABI=64 CC=gcc CFLAGS="-O3 -m64" --build=x86_64-w64-mingw32 --enable-gmpcompat --disable-static --enable-shared make make install make check The files are now here: C:\msys64\usr\bin\libgmp-23.dll C:\msys64\usr\bin\libmpir-23.dll C:\msys64\usr\lib\libgmp.la C:\msys64\usr\lib\libgmp.dll.a C:\msys64\usr\lib\libmpir.la C:\msys64\usr\lib\libmpir.dll.a C:\msys64\usr\include\gmp.h C:\msys64\usr\include\mpir.h If you remove the --enable-gmpcompat from the configure line you only get the mpir versions of the files. Last fiddled with by ATH on 2017-08-28 at 23:30 |
|
|
|
|
|
#6 |
|
P90 years forever!
Aug 2002
Yeehaw, FL
2·53·71 Posts |
Thanks for the help.
I did finally succeed, kinda, in building a 32-bit DLL of GMP using Mingw-w64 and MSYS2. I needed to do this: pacman -S mingw-w64-i686-gcc instead of: pacman -S gcc Like ATH, 'make check' fails. But my baby test program succeeds after renaming libgmp-10.dll to libgmp-3.dll.dll. I have not looked at mpir yet. I cannot compile it with MSVC as I'm using MSVC 2005. Last I checked, the free MSVC versions would not build 64-bit binaries. |
|
|
|
|
|
#7 | |
|
Sep 2016
22·83 Posts |
Quote:
|
|
|
|
|
|
|
#8 |
|
Einyen
Dec 2003
Denmark
35×13 Posts |
Do you trust it when "make check" fails? If you do here is how I compiled the 64-bit version of GMP 6.1.2:
./configure ABI=64 CC=gcc CFLAGS="-O3 -m64" --build=x86_64-w64-mingw32 --disable-static --enable-shared make make install make check Files are in C:\msys64\usr\bin, C:\msys64\usr\lib, C:\msys64\usr\include. Last fiddled with by ATH on 2017-08-28 at 23:42 |
|
|
|
|
|
#9 | |
|
Einyen
Dec 2003
Denmark
35×13 Posts |
Quote:
When I had to compile a 32-bit version a while ago, I installed the 32-bit version of MSYS2: msys2-i686-20161025.exe. It installs to c:\msys32 so you can have that and the 64 bit version at the same time. I used these commands and packages: pacman -Syu restart MSYS2 pacman -Su pacman -S gcc pacman -S make pacman -S autoconf pacman -S libtool pacman -S automake Last fiddled with by ATH on 2017-08-28 at 23:59 |
|
|
|
|
|
|
#10 |
|
P90 years forever!
Aug 2002
Yeehaw, FL
1D6616 Posts |
|
|
|
|
|
|
#11 |
|
P90 years forever!
Aug 2002
Yeehaw, FL
2×53×71 Posts |
MPIR compiles quite a bit cleaner. I've built a 32-bit DLL and run 'make check' successfully.
Two gotchas so far. The Makefile fails if the path contain blanks as in --prefix=/home/'George Woltman'/mpir-3.0.0 Building the .lib file for the DLL requires renaming the libmpir-3.dll.def file before executing the MSVC library manager. Last fiddled with by Prime95 on 2017-08-29 at 01:50 |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Building sr1sieve for RPi | wombatman | Software | 14 | 2017-03-04 16:21 |
| Building MSieve without VS? | SWSaunders | Msieve | 3 | 2013-04-26 11:19 |
| Help building new computer | Prime95 | Hardware | 30 | 2009-09-12 05:58 |
| Building gcc 4.4.0 | CRGreathouse | Software | 1 | 2009-07-07 22:25 |
| Building on Linux? | FenwayFrank | Software | 4 | 2002-10-20 21:59 |