apron icon indicating copy to clipboard operation
apron copied to clipboard

Review README & build instructions

Open antoinemine opened this issue 7 years ago • 7 comments

antoinemine avatar Jan 10 '19 00:01 antoinemine

README and build instructions for Linux and Windows have been reviewed. The README for Mac is not up-to-date though.

antoinemine avatar Nov 10 '19 00:11 antoinemine

Here are some instructions to install Apron on Mac OS X. I'm using Macports. Others use Homebrew where things may be located in different directories or named differently...

To install the mlgmpidl dependency this worked for me:

  env CFLAGS="-I/opt/local/include/" LDFLAGS="-L/opt/local/lib/" opam install mlgmpidl

I could not install Apron though opam. Instead the following steps to compile from scratch seems to work:

   env GMP_PREFIX=/opt/local MPFR_PREFIX=/opt/local ./configure -prefix /opt/local -no-java -no-ppl -absolute-dylibs
   make
   sudo make install

Below follows the error I get from an opam install attempt. Suggestions for how to communicate the above options (-prefix, ...) as environment variables through opam are welcome!

$ env CFLAGS="-I/opt/local/include/" LDFLAGS="-L/opt/local/lib/" GMP_PREFIX=/opt/local MPFR_PREFIX=/opt/local opam install apron
The following actions will be performed:
  - install apron v0.9.12

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[apron.v0.9.12] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of apron failed at "/Users/jmid/.opam/opam-init/hooks/sandbox.sh build make -j3".

#=== ERROR while compiling apron.v0.9.12 ======================================#
# context     2.0.6 | macos/x86_64 | ocaml-base-compiler.4.09.0 | https://opam.ocaml.org/#541efd87
# path        ~/.opam/4.09.0/.opam-switch/build/apron.v0.9.12
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j3
# exit-code   2
# env-file    ~/.opam/log/apron-80570-ad8886.env
# output-file ~/.opam/log/apron-80570-ad8886.out
### output ###
# [...]
# ld: library not found for -lmpfr
# ld: library not found for -lmpfr
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
# File "caml_startup", line 1:
# Error: Error during linking
# File "caml_startup", line 1:
# Error: Error during linking
# make[1]: *** [apron.d.cmxs] Error 2
# make[1]: *** Waiting for unfinished jobs....
# make[1]: *** [apron.cmxs] Error 2
# make: *** [ml] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build apron v0.9.12
+- 
- No changes have been performed

jmid avatar Jul 09 '20 12:07 jmid

I encountered the same linking error, and https://github.com/antoinemine/apron/pull/28 fixed it for me.

jberdine avatar Jul 09 '20 12:07 jberdine

To install Apron on Mac OS X using Homebrew I did the following:

  1. Installed GMP and MPFR brew install gmp and brew install mpfr
  2. Linked the installed GMP and MPFR from /usr/local ln -s /usr/local/Cellar/gmp/ /usr/local/ and ln -s /usr/local/Cellar/mpfr/ /usr/local/
  3. Installed Apron from sources

In my case, I configured the latter step with -no-cxx -no-java -no-ocaml -no-ppl but it shouldn't be a problem to allow at least C++ and Ocaml. I couldn't find a better way around step 2) (the GMP_PREFIX and MPFR_PREFIX options were not happy about looking things up in /usr/local/Cellar/...).

caterinaurban avatar Jul 09 '20 12:07 caterinaurban

I've merged #28, which should help. Jan, Caterina, could you confirm that it works? (without symlinks!)

I imagine you still need to specify GMP_PREFIX and MPFR_PREFIX by hand, though, and the value depends on Homebrew vs. Macports. It would be nice to fix the ./configure and the apron.opam to get this automatically on MacOS, though (and possibly for mlgmpidl as well). Opam already knows that you need --absolute-dylibs. Any idea?

antoinemine avatar Jul 10 '20 15:07 antoinemine

I can confirm that I can now install using opam.
I downloaded the latest the Apron version with #28 and locally installed as follows:

  env GMP_PREFIX=/opt/local MPFR_PREFIX=/opt/local opam install .

I don't expect any issues once this makes its way to the opam repository and gets downloaded automatically by opam from there.

In my current Macports setup I have installed the GNU toolchain from binutils and put them in the PATH. Hence something like this to reproduce:

 sudo port install binutils
 export PATH=/opt/local/libexec/gnubin:$PATH
 env GMP_PREFIX=/opt/local MPFR_PREFIX=/opt/local opam install .

jmid avatar Jul 10 '20 17:07 jmid

For the record, I haven't needed to set environment variables to install using opam with gmp and mpfr installed via homebrew. Note though that e.g. the conf-mpfr package expects homebrew to install the libraries into /usr/local/lib and macports to install them into /opt/local/lib. I think I have a default setup of homebrew, which does populate /usr/local/lib with symlinks into /usr/local/Cellar. I don't know if there is a better way / one with fewer hard-coded assumptions.

jberdine avatar Jul 10 '20 19:07 jberdine