O2 compilation fails on MPFR, complaining about the installed GMP "libgmp not found or uses a different ABI"

I am building O2 from scratch in a Macbook 2012 with clean Catalina 10.15.7 with all updates.

MPFR compilation fails because it finds GMP but identifies a problem with it. The log file at BUILD/MPFR-latest/log shows the following:

            checking whether gcc __attribute__ ((mode (XX))) works... yes
            checking for recent GMP... yes
	checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... yes
	checking for __gmpz_init in -lgmp... no
	configure: error: libgmp not found or uses a different ABI (including static vs shared).

In internet, I found two cases related with error with gmpz_init and “different ABI” .

  1. First case seems closer to my case. It is a linker problem as described in c++ - Installing & Finding GMP under OSX - Stack Overflow . This may be my case because Homebrew installed GMP (/usr/local/Cellar/gmp/6.2.1_1/include/gmp.h) , but aliBuild also compiled GMP. However, I don’t know how to test if this is my problem.

  2. This seems unrelated with my case, but it may be related because I have an old Macbook 2012 with Catalina. They identified the problem is their system is 64bit but GMP expected a 32bit ( javascript - Compiling GMP/MPFR with Emscripten - Stack Overflow ) . This was documented since 2013 ( e.g. llvm - Can't get GMP lib compiling with Emscripten - Stack Overflow https://groups.google.com/g/emscripten-discuss/c/kGi8O1vGBVQ ).

I understand that the compilation environment for MPFR is at …/sw/SPECS/osx_x86-64/ MPFR/v3.1.3-local1/build.sh but I don’t understand how to modify it or make a custom environment for it.

Thanks for your help!


Just to report that I found a “solution”. I was using macOS to compile in a NTFS partition, as I had being doing previously with success. The current problem when compiling GMP/MPFR dissapear by compiling O2 in a hfs+ partition.

This is just a partial solution because I still don’t know what the problem is, and I am still unable to compile in a NTFS partition. Maybe it is how the simlinks are done now? Is there a change on how aliBuild makes links?

As a side note, I am using Paragon NTFS to work with NTFS partitions in macOS, but I have not updated Paragon NTFS since last year, so I am ruling out that there are changes in how the filesystem is accessed.