malyzajko / daisy

Other
42 stars 10 forks source link

Instructions in README.md for MPFR on MacOS #2

Open vinc17fr opened 6 years ago

vinc17fr commented 6 years ago

In README.md it is written: "On macOS, homebrew installs libmpfr.6.dylib, even though the latest version is 4. Renaming the library to libmpfr.4.dylib fixes this issue."

The "6" in the dylib file is correct and comes from the latest supported MPFR ABI. It is not related to the MPFR major version number. For MPFR 3.0.x and MPFR 3.1.x, the latest supported ABI is 4, hence libmpfr.4.dylib with these versions. And since MPFR 4.0.0 is not ABI compatible with the previous MPFR versions, its latest supported ABI is 6, hence libmpfr.6.dylib with MPFR 4.0.x. Renaming this file to libmpfr.4.dylib may yield failures (incorrect results or crashes) in software compiled against MPFR 3.x. Here, I think that the ABI incompatibilities are rather minor, affecting only particular applications, but I'm not sure. In any case, the rename is a bad idea.

malyzajko commented 6 years ago

Thanks for the comments! The issue is that we are using the Java MPFR interface and that expects the library to be called libmpfr.4.dylib. Perhaps a better solution to this renaming would be to have homebrew install the right version. Do you know if this works (reliably)?

vinc17fr commented 6 years ago

I suppose that the Java MPFR interface expects libmpfr.4.dylib because it had been compiled against MPFR 3.x. So, the solution would be to reinstall the Java MPFR interface, and actually everything that depends on MPFR. See https://github.com/Homebrew/homebrew-science/issues/869 for a similar issue.

malyzajko commented 6 years ago

Thanks for the explanation, I will check this to see whether I can find a good solution which works both on Linux and Mac.

vinc17fr commented 6 years ago

Under Linux, the problem is solved by having co-installable libraries with binary distributions. For instance, in Debian/unstable, I have both libmpfr4 3.1.6-1 (which provides libmpfr.so.4) and libmpfr6 4.0.1-1 (which provides libmpfr.so.6) installed.