The Zarith library implements arithmetic and logical operations over arbitrary-precision integers and rational numbers. The implementation, based on GMP, is very efficient.
On Win32 with MSVC compiler and MSYS2 shell, the Opam build steps show:
...
- + GMP_INCLUDE=-IZ:/dckbuild/windows_x86_64/vcpkg_installed/x64-windows/include
- + LDFLAGS=' -LZ:/dckbuild/windows_x86_64/vcpkg_installed/x64-windows/lib -lgmp'
- + CCLINKERFLAGS=' -LIBPATH:Z:/dckbuild/windows_x86_64/vcpkg_installed/x64-windows/lib gmp.lib'
- + CPPFLAGS=' -IZ:/dckbuild/windows_x86_64/vcpkg_installed/x64-windows/include'
- + CFLAGS=' -IZ:/dckbuild/windows_x86_64/vcpkg_installed/x64-windows/include'
- + ./configure
- binary ocaml: found in /z/dckbuild/windows_x86_64/Debug/dksdk/ocaml/bin
- binary ocamlc: found in /z/dckbuild/windows_x86_64/Debug/dksdk/ocaml/bin
- binary ocamldep: found in /z/dckbuild/windows_x86_64/Debug/dksdk/ocaml/bin
- binary ocamlmklib: found in /z/dckbuild/windows_x86_64/Debug/dksdk/ocaml/bin
- binary ocamldoc: found in /z/dckbuild/windows_x86_64/Debug/dksdk/ocaml/bin
- binary gcc: not found
- binary gcc: not found
- binary cc: not found
- binary cl: found in /c/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/HostX64/x64
- binary ocamlopt: found in /z/dckbuild/windows_x86_64/Debug/dksdk/ocaml/bin
- checking compilation with cl : working
- include caml/mlvalues.h: found
- library dynlink.cmxa: found
- binary ocamlfind: found in /z/dckbuild/windows_x86_64/Debug/dksdk/_opam/bin
- OCaml's word size is 64
- binary uname: found in /usr/bin
- ./configure: unable to guess system type
-
- This script, last modified 2010-09-24, has failed to recognize
- the operating system you are using. It is advised that you
- download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
- and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
- - If the version you run (./configure) is already up to date, please
- send the following data and any information you think might be
- pertinent to <config-patches@gnu.org> in order to provide the needed
- information to handle your system.
-
- config.guess timestamp = 2010-09-24
-
- uname -m = x86_64
- uname -r = 3.3.4-341.x86_64
- uname -s = MSYS_NT-10.0-22567
- uname -v = 2022-02-15 17:24 UTC
-
- /usr/bin/uname -p = unknown
- /bin/uname -X =
-
- hostinfo =
- /bin/universe =
- /usr/bin/arch -k =
- /bin/arch = x86_64
- /usr/bin/oslevel =
- /usr/convex/getsysinfo =
-
- UNAME_MACHINE = x86_64
- UNAME_RELEASE = 3.3.4-341.x86_64
- UNAME_SYSTEM = MSYS_NT-10.0-22567
- UNAME_VERSION = 2022-02-15 17:24 UTC
- include gmp.h: found
- library gmp: found
- __gmpn_divexact: not found
- OCaml supports -bin-annot to produce documentation
-
- detected configuration:
-
- native-code: yes
- dynamic linking: yes
- defines: -DHAS_GMP
- libraries: -LZ:/dckbuild/windows_x86_64/vcpkg_installed/x64-windows/lib -lgmp -lgmp
- C options:
- installation path: Z:/dckbuild/windows_x86_64/Debug/dksdk/_opam/lib
- installation method findlib
-
- configuration successful!
- now type "make" to build
- then type "make install" or "sudo make install" to install
Note: The config.guess is ancient so it will not recognize MSYS2, but the results of ./config.guess aren't even used.
Changes
Since native Windows does not have an analog to
/usr/lib
or/usr/local/lib
, use environment variables to pass through external gmp libraries.test -x
will fail on Windows "executables" that do not have an .exe extension, so use .obj and .exe extensions correctly.Standard (vcpkg) MSVC compile of gmp 6.2 does not expose
__gmpn_divexact
so probe for its existence during ./configureFor item 3 above, before the PR the ca-certs-nss.3.74 package would complain:
Testing
https://github.com/jonahbeckford/Zarith/runs/5518724099 are the normal GitHub Actions. The probe of
_gmpn_divexact
showsdefines: -DHAS_GMPN_DIVEXACT -DHAS_GMP
for Ubuntu but not for macOS.On Win32 with MSVC compiler and MSYS2 shell, the Opam build steps show:
Note: The
config.guess
is ancient so it will not recognize MSYS2, but the results of./config.guess
aren't even used.