Installing php-decimal in MacOS arm64e and can't get libmpdec

Viewed 358

I've just upgraded to a MacBook with the M1 and when installing php-decimal with pecl install decimal, I receive the following error:

checking for libmpdec custom path... no
checking for libmpdec library in default path... found in /usr/local/lib
checking for libmpdec headers in default path... found in /usr/local/include
checking for mpd_version in -lmpdec... no
configure: error: Please check your version of libmpdec (2.4+)
ERROR: `/private/tmp/pear/temp/decimal/configure --with-php-config=/Applications/MAMP/bin/php/php8.0.8/bin/php-config' failed

I've used homebrew to install libmpdec brew install mpdecimal and I can see the files at usr/local/lib - they are aliases to the homebrew location with these files:

  • libmpdec++.a
  • libmpdec++.2.5.1.dylib
  • libmpdec.a
  • libmpdec.2.5.1.dylib
  • libmpdec++.dylib
  • libmpdec++.3.dylib
  • libmpdec.dylib
  • libmpdec.3.dylib

I'm just out of ideas here.

1 Answers

The ancient magic is looking for whether a function named mpd_version to determine if your version of the library has that function.

As you apparently have version 2.5.1 and 3 installed somewhere it should find it. But the error message is one that could result in an older version of the headers being present the directory /usr/local/include.

Can you look at the file mpdecimal.h in /usr/local/include to see if that file is present in there, and contains a definition of the function mpd_version in it.

Though it may also be failing at the linking step. You should be able to dump out which symbols are present in the lib by running nm -gC libmpdec.a or similar.

Related