I'm using CentOS 7 and building a PHP 7.4.10 rpm from source. We've previously been using PHP 7.2 with gmp located at /usr/lib64/
, so ./configure in the spec file takes --with-gmp=/usr/lib64
. This works with no problem, and I've also tested that it still works with PHP 7.3.22. Building PHP 7.4.10 however hits this error: configure: error: Unable to locate gmp.h
.
$ locate gmp.h
/usr/include/gmp.h
$ locate gmp.so
/usr/lib64/libgmp.so
/usr/lib64/libgmp.so.10
/usr/lib64/libgmp.so.10.2.0
%build
cd %{_builddir}/php-%{version}
export CC=/usr/local/gcc/bin/gcc
export CXX=/usr/local/gcc/bin/g++
export CFLAGS="-O3 -m64 -isystem/usr/local/gcc/include -L/usr/local/gcc/lib64 -Wl,--rpath=/usr/local/gcc/lib64 "
export CXXFLAGS=$CFLAGS
./configure --with-gmp=/usr/lib64 --enable-bcmath --enable-ftp --with-curl --with-openssl --enable-mbstring
make -j8
$ rpm -qa | grep -i gmp
gmp-devel-6.0.0-15.el7.x86_64
gmp-6.0.0-15.el7.x86_64
I've tried putting a symlink between /usr/include/gmp.h
and /usr/lib64/gmp.h
, which didn't work. I've also tried adding -isystem/usr/include
and -isystem/usr/include/gmp.h
to CFLAGS, CPFLAGS, and CXXFLAGS.
I'm especially baffled since something seems to have changed for PHP 7.4, but I can't find any upgrade notes for it.
--with-gmp=/usr/lib64
searches for the files in /usr/lib64/include
and /usr/lib64/lib64
. You need to use --with-gmp=/usr
or --with-gmp=shared
.
It's usually quite helpful to consult distribution build scripts when encountering such issues, such as the PHP 7.4 RPM SPEC file for CentOS . Further below, you will see references to %{_prefix}
, which stands for /usr
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.