15

I am using ubuntu 13.10 x64, and I'm trying build php 5.3.8, I downloaded the source code and run the configure:

./configure --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 
--with-tidy --with-config-file-path=/usr/local/php/conf 
--with-config-file-scan-dir=/usr/local/php/conf.d --enable-debug --with-openssl 
--with-kerberos --with-zlib --enable-calendar --with-curl --with-curlwrappers 
--with-enchant --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr 
--with-png-dir=/usr --with-vpx-dir=/usr --with-freetype-dir=/usr --with-t1lib 
--enable-exif --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext 
--with-gmp --with-mhash --enable-intl --enable-mbstring --with-mcrypt --with-mysql 
--with-mysqli --enable-pcntl --with-pdo-mysql --with-pdo-pgsql 
--with-pgsql --with-pspell --with-libedit --with-readline --enable-shmop 
--with-snmp --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvshm 
--with-xsl --enable-zip --with-pear --enable-zend-signals --enable-maintainer-zts

And I got this error: configure: error: Unable to locate gmp.h

I have installed libgmp-dev and libgmp3-dev use sudo apt-get install libgmp-dev libgmp3-dev but still can't run the configure successfully, how can I fix this problem?


if I run locate gmp.h I can see it here:

/usr/include/linux/igmp.h
/usr/include/netinet/igmp.h
/usr/include/x86_64-linux-gnu/gmp.h
/usr/src/linux-headers-3.11.0-12/include/linux/igmp.h
/usr/src/linux-headers-3.11.0-12/include/uapi/linux/igmp.h
/usr/src/linux-headers-3.11.0-12-generic/include/linux/igmp.h
/usr/src/linux-headers-3.11.0-13/include/linux/igmp.h
/usr/src/linux-headers-3.11.0-13/include/uapi/linux/igmp.h
/usr/src/linux-headers-3.11.0-13-generic/include/linux/igmp.h

Thanks!

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
aserww106
  • 1,311
  • 3
  • 12
  • 14

2 Answers2

36

Do you have gmp.h anywhere on the system? If it is installed on a non-standard location (or the standard location has changed since the release of php 5.3.8) GCC might be looking for it in the wrong path.

My advice would be to locate gmp.h and if it isn't at usr/include/gmp.h try to symlink to it.

In response to your comment (and since comments syntax highligher is limited).

try symlinking it

ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h 

if that fails, see if you can compile including the parameter

--with-gmp=/usr/include/x86_64-linux-gnu

give a look to the gcc documentation. It has a small section about gmp path.

http://gcc.gnu.org/install/configure.html

ffflabs
  • 17,166
  • 5
  • 51
  • 77
  • Thank you @amenadiel , I runed `locate gmp.h`, please see my edit in my question. – aserww106 Nov 10 '13 at 19:54
  • 2
    try symlinking it **ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h** and, if that fails, see if you can compile including the parameter **--with-gmp= /usr/include/x86_64-linux-gnu** – ffflabs Nov 10 '13 at 20:22
  • 2
    The symlink did the trick, the *--with-gmp* option didn't work for me – mTorres Jul 11 '15 at 11:10
  • 2
    if file /usr/include/x86_64-linux-gnu/gmp.h doesn't exists, try to run "apt-get install libgmp-dev" – TermiT Aug 05 '15 at 20:45
6

This is a bug. I reported it -- https://bugs.php.net/bug.php?id=69993 -- and provided a patch to fix it.

  • Thank you very much for this info, but the patch doesn't seem to fix it for me. Symlinking the header file does. – Ian Oct 26 '17 at 17:34
  • Upvoted, thanks. I didn't use the patch, but knowing that it was expecting gmp.h to be inside an `include` folder helped me to fix my issue. – Craig Brown May 13 '19 at 15:10