This is something i’ve met while trying to install PHP-GMP extension.
What i was trying to do is:
- Downloaded gmp with brew using
brew install autoconf gmp
- Downloaded PHP (i’m using version 7.3.24) from source to extract the GMP extension
- Copied Gmp directory to
/Applications/MAMP/bin/php/php7.3.24/include/php/ext
- Entered that dir and launched
phpize
- 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:
- ./configure
- 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
Advertisement
Answer
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:
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.