![]() |
Help building GMP for prime95 29.3
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. |
Perhaps you could try [URL="http://mpir.org"]MPIR[/URL] 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) |
[url]https://stackoverflow.com/questions/4711315/build-gmp-on-64bit-windows[/url] might help ?
|
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: [url]https://gmplib.org/manual/Known-Build-Problems.html[/url] [QUOTE]Compiler link options The version of libtool currently in use rather aggressively strips compiler options when linking a shared library. This will hopefully be relaxed in the future, but for now if this is a problem the suggestion is to create a little script to hide them, and for instance configure with ./configure CC=gcc-with-my-options [/QUOTE] Anyone know how to do this? |
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: [url]http://www.msys2.org/[/url] Run: [B]pacman -Syu[/B] (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) [B]pacman -Su[/B] (restart MSYS2) install needed packages: [B]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[/B] (only needed for MPIR, not for GMP 6.1.2) Rename "[B]C:\msys64\mingw64\bin\mingw32-make.exe[/B]" to "[B]make.exe[/B]" 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 [url]http://mpir.org/downloads.html[/url] and compile: [B]./configure ABI=64 CC=gcc CFLAGS="-O3 -m64" --build=x86_64-w64-mingw32 --enable-gmpcompat --disable-static --enable-shared make make install make check[/B] 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. |
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. |
[QUOTE=Prime95;466534]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.[/QUOTE] Visual Studio 2015 and 2017 Community edition are free. And they have pretty much everything - including the 64-bit compiler. |
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. |
[QUOTE=Prime95;466534]I did finally succeed, kinda, in building a 32-bit DLL of GMP using Mingw-w64 and MSYS2.[/QUOTE]
Are you sure it is 32-bit if you used mingw-w64-i686-gcc ? 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 |
[QUOTE=ATH;466537]Are you sure it is 32-bit if you used mingw-w64-i686-gcc ?[/QUOTE]
Yes. The OS is Windows Vista 32-bit. As to trusting the DLL when I cannot build 'make check' --- no, I do not trust the DLL. Trying mpir compile now... |
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. |
| All times are UTC. The time now is 08:33. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.