1

This is something i've met while trying to install PHP-GMP extension.

What i was trying to do is:

  1. Downloaded gmp with brew using brew install autoconf gmp
  2. Downloaded PHP (i'm using version 7.3.24) from source to extract the GMP extension
  3. Copied Gmp directory to /Applications/MAMP/bin/php/php7.3.24/include/php/ext
  4. Entered that dir and launched phpize
  5. Launched `./configure --with-php-config=/Applications/MAMP/bin/php/php7.3.24/bin/php-config

As soon as i hit enter it starts doing it's stuff until it says:

configure: error: GNU MP Library version 4.2 or greater required.

Once i managed to solve this somehow but i really don't know how i did it. I can only remember of downloading the gmp .tar from the official website https://gmplib.org/#DOWNLOAD but then nothing works.

Let me say that i'm a total noob with those ./configure, make and make install stuff. I don't even know what is going on so all i did was random launching hoping something good could happen:

What i've tried after downloading the official .tar is entering the folder and go with:

  1. ./configure
  2. make && make check && make install

I've also tried to do:

export CPPFLAGS="-I/usr/local/Cellar/gmp/include"
export LDFLAGS="-L/usr/local/Cellar/gmp/lib"   

as suggested here but nothing changed. I even tried to add --prefix=/usr/local/Cellar to the ./configure command but no luck.

This all story is related to this other question of me where i was trying to go on with the issue when the ./configure was still working. Now it's like i went backwards.

Sidenote: i guess it all changed when i fired brew doctor, and brew cleanup. It must have destroyed something i made that brought me back to this state

Diego
  • 1,374
  • 1
  • 11
  • 23

1 Answers1

1

Ok this was quicker then i thought but i should leave it here as a reference for everyone else which will hit the same issue.

TLDR; You need to reinstall brew for the new architecture using this arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" and then install packages with this arch -x86_64 brew install <package>. Credits to emonz

Long version answer:

This issue all starts with brew, i don't even know why it wasn't giving me hints about this issue until just today. When i launched brew install gmp it printed this error:

enter image description here

which lead me to this answer from emonz. After i finally reinstalled brew i could finally get the ./configure command to work using additional args:

./configure --with-php-config=/Applications/MAMP/bin/php/php7.3.27/bin/php-config CC="gcc -arch x86_64" CXX="g++ -arch x86_64"

So basically it is all related to the new M1 chip i guess. I still don't know what i did in the past to solve this issue w/o upgrading brew to the new arch but somehow i did it. I'll leave the question and this answer more like a guide for future comers and give them hints of what they can try to solve the issue, i wish nobody go past this pain ever again.

Diego
  • 1,374
  • 1
  • 11
  • 23
  • Hi Diego, please help me out. I ran into the exact same issue. I ran the first command that you mentioned your answer. But I am not sure what package to install with the second one. If I install gmp, it creates a gmp folder in the Cellar, but if I copy that into the MAMP php folder the phpize command doesn't work. I need to use the gmp folder that I get from the php that download from source for the phpize to work, but then, of course, I get configure: error: GNU MP Library version 4.2 or greater required. – Vlad Dogarescu Apr 25 '22 at 19:39
  • Hi @VladDogarescu, to be 100% honest with you, i don't know why/how it worked when i first tried that 1y ago, but as of today, after 1y and several macOsx updates, Mamp pro (and so PHP) updates, it no longer work for me aswell. I needed it and tried a bit but after a while i just gave up. I don't have enought knowledge on this subject to understand what i'm doing wrong. I'm sorry my fellow programmer – Diego Apr 27 '22 at 12:23
  • 1
    Thank you, Diego! I will let you know if I fix it. – Vlad Dogarescu Apr 27 '22 at 19:09