Compiling Zarith 1.14 on MacOS ARM
The ./configure does not seem to find gmp.h on ARM based MacOS even though the gmp 6.3.0 is installed with homebrew.
binary ocaml: found in /Users/arozovyk/.opam/default/bin
binary ocamlc: found in /Users/arozovyk/.opam/default/bin
binary ocamldep: found in /Users/arozovyk/.opam/default/bin
binary ocamlmklib: found in /Users/arozovyk/.opam/default/bin
binary ocamldoc: found in /Users/arozovyk/.opam/default/bin
binary ocamlopt: found in /Users/arozovyk/.opam/default/bin
checking compilation with ocamlc -O3 -Wall -Wextra : working
include caml/mlvalues.h: found
library dynlink.cmxa: found
binary ocamlfind: found in /Users/arozovyk/.opam/default/bin
OCaml's word size is 64
include gmp.h: not found
include mpir.h: not found
cannot find GMP nor MPIR
Setting the env variables to indicate the path allows to build locally
export CPPFLAGS="-I/opt/homebrew/Cellar/gmp/6.3.0/include $CPPFLAGS"
export LDFLAGS="-L/opt/homebrew/Cellar/gmp/6.3.0/lib $LDFLAGS"
./configure
make
Note: I just removed a comment by user abdulhkeemGit that contained a link to a zip-file hosted on mediafire containing executable code, with no explanation and seemingly no relation to the issue at hand.
1 year later.. Might want to generalize that rather than hardcode some arbitrary path:
if command -v brew 2>/dev/null; then
zarith_gmp_root=$(brew --prefix gmp)
if [ -n "${zarith_gmp_root-}" ]; then
export CPPFLAGS="-I${zarith_gmp_root}/include${CPPFLAGS:+ }${CPPFLAGS-}"
export LDFLAGS="-L${zarith_gmp_root}/lib${LDFLAGS:+ }${LDFLAGS-}"
fi
unset zarith_gmp_root
fi
FYI: I had to brew reinstall ocaml-zarith -s because the brew bottle contained a bunch of stale .cmi's that prevented the installation of coq. Homebrew is a shitshow hostile to dev UX, tinkering, constructive criticism, usability, and common sense, but that's beyond the scope here. ;o)